summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in31
-rw-r--r--gl/m4/warnings.m485
-rw-r--r--lib/ASN1.c5
-rw-r--r--lib/ASN1.y5
-rw-r--r--lib/coding.c16
-rw-r--r--lib/decoding.c13
-rw-r--r--lib/element.c9
-rw-r--r--lib/errors.c39
-rw-r--r--lib/int.h11
-rw-r--r--lib/structure.c4
10 files changed, 152 insertions, 66 deletions
diff --git a/configure.in b/configure.in
index 2fabbe0..be691b8 100644
--- a/configure.in
+++ b/configure.in
@@ -57,10 +57,35 @@ GTK_DOC_CHECK(1.2)
# For gnulib compatibility modules in gl/.
gl_INIT
-gl_WARN_ADD([-Wall])
-gl_WARN_ADD([-Wpointer-arith])
-gl_WARN_ADD([-Wstrict-prototypes])
+gl_WARN_SUPPORTED([WARNINGS])
+
+# Useless warnings for libidn.
+USELESS_WARNINGS=" \
+ -Wc++-compat \
+ -Woverlength-strings \
+ -Wsystem-headers \
+ -Wtraditional \
+ -Wtraditional-conversion"
+gl_WARN_COMPLEMENT(WARNINGS, [$WARNINGS], [$USELESS_WARNINGS])
+# Review these from time to time.
+USELESS_WARNINGS=" \
+ -Wconversion \
+ -Wsign-conversion \
+ -Wold-style-definition \
+ -Wpadded \
+ -Wsign-compare \
+ -Wunreachable-code \
+ -Wunsafe-loop-optimizations \
+ -Wstrict-overflow"
+gl_WARN_COMPLEMENT(WARNINGS, [$WARNINGS], [$USELESS_WARNINGS])
+
+for w in $WARNINGS; do
+ gl_WARN_ADD([$w])
+done
+
gl_WARN_ADD([-Wno-pointer-sign])
+gl_WARN_ADD([-Wno-unused-parameter])
+gl_WARN_ADD([-fdiagnostics-show-option])
AC_CONFIG_FILES([
Makefile
diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4
index d2854d9..f836793 100644
--- a/gl/m4/warnings.m4
+++ b/gl/m4/warnings.m4
@@ -42,3 +42,88 @@ AS_VAR_POPDEF([gl_Flags])dnl
AS_VAR_POPDEF([gl_Warn])dnl
m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
])
+
+# gl_WARN_SUPPORTED(VARIABLE)
+# ----------------------
+# Add all supported warning parameters to variable VARIABLE.
+AC_DEFUN([gl_WARN_SUPPORTED],
+[
+ FOO=
+ # List of all supported warning parameters according to GCC 4.3.2 manual.
+ for w in \
+ -Wall \
+ -W \
+ -Wformat-y2k \
+ -Wformat-nonliteral \
+ -Wformat-security \
+ -Winit-self \
+ -Wmissing-include-dirs \
+ -Wswitch-default \
+ -Wswitch-enum \
+ -Wunused \
+ -Wunknown-pragmas \
+ -Wstrict-aliasing \
+ -Wstrict-overflow \
+ -Wsystem-headers \
+ -Wfloat-equal \
+ -Wtraditional \
+ -Wtraditional-conversion \
+ -Wdeclaration-after-statement \
+ -Wundef \
+ -Wshadow \
+ -Wunsafe-loop-optimizations \
+ -Wpointer-arith \
+ -Wbad-function-cast \
+ -Wc++-compat \
+ -Wcast-qual \
+ -Wcast-align \
+ -Wwrite-strings \
+ -Wconversion \
+ -Wsign-conversion \
+ -Wlogical-op \
+ -Waggregate-return \
+ -Wstrict-prototypes \
+ -Wold-style-definition \
+ -Wmissing-prototypes \
+ -Wmissing-declarations \
+ -Wmissing-noreturn \
+ -Wmissing-format-attribute \
+ -Wpacked \
+ -Wpadded \
+ -Wredundant-decls \
+ -Wnested-externs \
+ -Wunreachable-code \
+ -Winline \
+ -Winvalid-pch \
+ -Wlong-long \
+ -Wvla \
+ -Wvolatile-register-var \
+ -Wdisabled-optimization \
+ -Wstack-protector \
+ -Woverlength-strings \
+ ; do
+ FOO="$FOO $w"
+ done
+ $1=$FOO
+])
+
+# gl_WARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
+# ----------------------
+# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
+# Elements separated by whitespace. In set logic terms, the function
+# does OUTVAR = LISTVAR \ REMOVEVAR.
+AC_DEFUN([gl_WARN_COMPLEMENT],
+[
+ FOO=
+ set -- "$2"
+ for w in $_; do
+ case "$3" in
+ *" $w "* | *" $w" | "$w "*)
+ ;;
+ *)
+ FOO="$FOO $w"
+ ;;
+ esac
+ done
+ $1=$FOO
+])
diff --git a/lib/ASN1.c b/lib/ASN1.c
index be533ce..1cbb7b0 100644
--- a/lib/ASN1.c
+++ b/lib/ASN1.c
@@ -2384,6 +2384,7 @@ _asn1_yylex()
{
int c,counter=0,k,lastc;
char string[ASN1_MAX_NAME_SIZE+1]; /* will contain the next token */
+ size_t i;
while(1)
{
@@ -2450,8 +2451,8 @@ _asn1_yylex()
}
/* Is STRING a keyword? */
- for(k=0;k<(sizeof(key_word)/sizeof(char*));k++)
- if(!strcmp(string,key_word[k])) return key_word_token[k];
+ for(i=0;i<(sizeof(key_word)/sizeof(char*));i++)
+ if(!strcmp(string,key_word[i])) return key_word_token[i];
/* STRING is an IDENTIFIER */
strcpy(yylval.str,string);
diff --git a/lib/ASN1.y b/lib/ASN1.y
index 94b63f9..1b30822 100644
--- a/lib/ASN1.y
+++ b/lib/ASN1.y
@@ -432,6 +432,7 @@ _asn1_yylex()
{
int c,counter=0,k,lastc;
char string[ASN1_MAX_NAME_SIZE+1]; /* will contain the next token */
+ size_t i;
while(1)
{
@@ -498,8 +499,8 @@ _asn1_yylex()
}
/* Is STRING a keyword? */
- for(k=0;k<(sizeof(key_word)/sizeof(char*));k++)
- if(!strcmp(string,key_word[k])) return key_word_token[k];
+ for(i=0;i<(sizeof(key_word)/sizeof(char*));i++)
+ if(!strcmp(string,key_word[i])) return key_word_token[i];
/* STRING is an IDENTIFIER */
strcpy(yylval.str,string);
diff --git a/lib/coding.c b/lib/coding.c
index 63d38a7..9a5821b 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -45,7 +45,7 @@
/* ErrorDescription: string returned. */
/* Return: */
/******************************************************/
-void
+static void
_asn1_error_description_value_not_found (ASN1_TYPE node,
char *ErrorDescription)
{
@@ -113,7 +113,7 @@ asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
/* (ans[0]..ans[ans_len-1]). */
/* Return: */
/******************************************************/
-void
+static void
_asn1_tag_der (unsigned char class, unsigned int tag_value,
unsigned char *ans, int *ans_len)
{
@@ -179,7 +179,7 @@ asn1_octet_der (const unsigned char *str, int str_len,
/* ASN1_MEM_ERROR when DER isn't big enough */
/* ASN1_SUCCESS otherwise */
/******************************************************/
-asn1_retCode
+static asn1_retCode
_asn1_time_der (unsigned char *str, unsigned char *der, int *der_len)
{
int len_len;
@@ -250,7 +250,7 @@ _asn1_get_utctime_der(unsigned char *der,int *der_len,unsigned char *str)
/* ASN1_MEM_ERROR when DER isn't big enough */
/* ASN1_SUCCESS otherwise */
/******************************************************/
-asn1_retCode
+static asn1_retCode
_asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
{
int len_len, counter, k, first, max_len;
@@ -370,7 +370,7 @@ asn1_bit_der (const unsigned char *str, int bit_len,
/* ASN1_MEM_ERROR if der vector isn't big enough, */
/* otherwise ASN1_SUCCESS. */
/******************************************************/
-asn1_retCode
+static asn1_retCode
_asn1_complete_explicit_tag (ASN1_TYPE node, unsigned char *der,
int *counter, int *max_len)
{
@@ -443,7 +443,7 @@ _asn1_complete_explicit_tag (ASN1_TYPE node, unsigned char *der,
/* ASN1_MEM_ERROR if der vector isn't big enough, */
/* otherwise ASN1_SUCCESS. */
/******************************************************/
-asn1_retCode
+static asn1_retCode
_asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, int *counter,
int *max_len)
{
@@ -604,7 +604,7 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, int *counter,
/* node: pointer to the SET element. */
/* Return: */
/******************************************************/
-void
+static void
_asn1_ordering_set (unsigned char *der, int der_len, ASN1_TYPE node)
{
struct vet
@@ -718,7 +718,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, ASN1_TYPE node)
/* node: pointer to the SET OF element. */
/* Return: */
/******************************************************/
-void
+static void
_asn1_ordering_set_of (unsigned char *der, int der_len, ASN1_TYPE node)
{
struct vet
diff --git a/lib/decoding.c b/lib/decoding.c
index 9e162e5..b120931 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -237,7 +237,7 @@ asn1_get_octet_der (const unsigned char *der, int der_len,
/* Returns ASN1_SUCCESS on success or an error code on error.
*/
-int
+static int
_asn1_get_time_der (const unsigned char *der, int der_len, int *ret_len,
char *str, int str_size)
{
@@ -257,7 +257,7 @@ _asn1_get_time_der (const unsigned char *der, int der_len, int *ret_len,
-void
+static void
_asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
char *str, int str_size)
{
@@ -340,7 +340,7 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
-int
+static int
_asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
int *ret_len)
{
@@ -539,7 +539,7 @@ _asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
}
-int
+static int
_asn1_delete_not_used (ASN1_TYPE node)
{
ASN1_TYPE p, p2;
@@ -598,7 +598,8 @@ _asn1_delete_not_used (ASN1_TYPE node)
return ASN1_SUCCESS;
}
-asn1_retCode _asn1_extract_der_octet(ASN1_TYPE node, const unsigned char *der, int der_len)
+static asn1_retCode
+_asn1_extract_der_octet(ASN1_TYPE node, const unsigned char *der, int der_len)
{
int len2, len3;
int counter2, counter_end;
@@ -640,7 +641,7 @@ int counter2, counter_end;
}
-asn1_retCode
+static asn1_retCode
_asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
{
int len2, len3, counter, tot_len, indefinite;
diff --git a/lib/element.c b/lib/element.c
index f9cd3c7..05da2f2 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -281,6 +281,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
ASN1_TYPE node, p, p2;
unsigned char *temp, *value_temp = NULL, *default_temp = NULL;
int len2, k, k2, negative;
+ size_t i;
const unsigned char *value = ivalue;
node = asn1_find_node (node_root, name);
@@ -492,8 +493,8 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
_asn1_free (value_temp);
break;
case TYPE_OBJECT_ID:
- for (k = 0; k < strlen (value); k++)
- if ((!isdigit (value[k])) && (value[k] != '.') && (value[k] != '+'))
+ for (i = 0; i < strlen (value); i++)
+ if ((!isdigit (value[i])) && (value[i] != '.') && (value[i] != '+'))
return ASN1_VALUE_NOT_VALID;
if (node->type & CONST_DEFAULT)
{
@@ -636,8 +637,8 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
}
#define ADD_STR_VALUE( ptr, ptr_size, data) \
- *len = strlen(data) + 1; \
- if (ptr_size < strlen(ptr)+(*len)) { \
+ *len = (int) strlen(data) + 1; \
+ if (ptr_size < (int) strlen(ptr)+(*len)) { \
return ASN1_MEM_ERROR; \
} else { \
/* this strcat is checked */ \
diff --git a/lib/errors.c b/lib/errors.c
index c749df2..29e08dc 100644
--- a/lib/errors.c
+++ b/lib/errors.c
@@ -100,42 +100,3 @@ asn1_strerror (asn1_retCode error)
return NULL;
}
-
-#ifndef ASN1_DISABLE_DEPRECATED
-
-/* Compatibility mappings to preserve ABI. */
-
-/**
- * libtasn1_perror - prints a string to stderr with a description of an error
- * @error: is an error returned by a libtasn1 function.
- *
- * This function is like perror(). The only difference is that it
- * accepts an error returned by a libtasn1 function.
- *
- * Deprecated: Use asn1_perror() instead.
- **/
-void
-libtasn1_perror (asn1_retCode error)
-{
- asn1_perror (error);
-}
-
-/**
- * libtasn1_strerror - Returns a string with a description of an error
- * @error: is an error returned by a libtasn1 function.
- *
- * This function is similar to strerror(). The only difference is
- * that it accepts an error (number) returned by a libtasn1 function.
- *
- * Returns: Pointer to static zero-terminated string describing error
- * code.
- *
- * Deprecated: Use asn1_strerror() instead.
- **/
-const char *
-libtasn1_strerror (asn1_retCode error)
-{
- return asn1_strerror (error);
-}
-
-#endif
diff --git a/lib/int.h b/lib/int.h
index 65cc10b..01f8e7f 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -140,4 +140,15 @@ struct node_asn
#define CONST_DOWN (1<<29)
#define CONST_RIGHT (1<<30)
+/* Prototypes for gstr.c. */
+void _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src);
+void _asn1_str_cpy (char *dest, size_t dest_tot_size, const char *src);
+
+/* Prototypes for element.c. */
+void _asn1_hierarchical_name (ASN1_TYPE node, char *name, int name_size);
+asn1_retCode _asn1_convert_integer (const char *value,
+ unsigned char *value_out,
+ int value_out_size, int *len);
+int _asn1_append_sequence_set (ASN1_TYPE node);
+
#endif /* INT_H */
diff --git a/lib/structure.c b/lib/structure.c
index d0d22c0..2701cf7 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -467,7 +467,7 @@ _asn1_copy_structure2 (ASN1_TYPE root, const char *source_name)
}
-asn1_retCode
+static asn1_retCode
_asn1_type_choice_config (ASN1_TYPE node)
{
ASN1_TYPE p, p2, p3, p4;
@@ -552,7 +552,7 @@ _asn1_type_choice_config (ASN1_TYPE node)
}
-asn1_retCode
+static asn1_retCode
_asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
{
ASN1_TYPE p, p2, p3;