diff options
author | Fabio Fiorina <fiorinaf@gnutls.org> | 2002-10-09 20:19:23 +0000 |
---|---|---|
committer | Fabio Fiorina <fiorinaf@gnutls.org> | 2002-10-09 20:19:23 +0000 |
commit | 6a27efc885b5975c1688573db640c672ab803116 (patch) | |
tree | 530efe5ef319bf000d32629894de6e624f71550d | |
parent | a7ebd7b492debee64c68847f5c8cd97f2c2e2882 (diff) | |
download | libtasn1_0_1_2.tar.gz |
C99 macrolibtasn1_0_1_2
-rw-r--r-- | configure.in | 19 | ||||
-rw-r--r-- | lib/ASN1.c | 4 | ||||
-rw-r--r-- | lib/ASN1.y | 4 | ||||
-rw-r--r-- | lib/element.c | 6 | ||||
-rw-r--r-- | lib/errors.c | 14 | ||||
-rw-r--r-- | lib/errors.h | 13 | ||||
-rw-r--r-- | lib/int.h | 3 |
7 files changed, 50 insertions, 13 deletions
diff --git a/configure.in b/configure.in index 518edda..6ba2bc2 100644 --- a/configure.in +++ b/configure.in @@ -62,13 +62,30 @@ AC_C_CONST AC_C_INLINE +AC_MSG_CHECKING([whether C99 macros are supported]) +AC_TRY_COMPILE(,[ +#define test_mac(...) +int z,y,x; +test_mac(x,y,z); +return 0; +], +dnl ***** OK +AC_DEFINE(C99_MACROS, 1, [C99 macros are supported]) +AC_MSG_RESULT(yes), +dnl ***** NOT FOUND +AC_MSG_RESULT(no) +AC_MSG_WARN([C99 macros are not supported by your compiler. This may +affect compiling.]) +) + + if test $ac_cv_c_compiler_gnu != no; then CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wstrict-prototypes" AC_MSG_CHECKING([whether we have GNU assembler]) - GAS=`as --version < /dev/null 2>/dev/null | grep GNU` + GAS=`as --version < /dev/null|grep GNU` if test "$GAS"; then CFLAGS="${CFLAGS} -pipe" AC_MSG_RESULT(yes) @@ -2140,8 +2140,8 @@ int _asn1_yyerror (char *s) { /* Sends the error description to the std_out */ -#ifdef DEBUG_PARSER - _libasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName, +#ifdef LIBTASN1_DEBUG_PARSER + _libtasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName, lineNumber,s,lastToken); #endif @@ -754,8 +754,8 @@ int _asn1_yyerror (char *s) { /* Sends the error description to the std_out */ -#ifdef DEBUG_PARSER - _libasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName, +#ifdef LIBTASN1_DEBUG_PARSER + _libtasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName, lineNumber,s,lastToken); #endif diff --git a/lib/element.c b/lib/element.c index d8c4315..fcedf18 100644 --- a/lib/element.c +++ b/lib/element.c @@ -111,10 +111,10 @@ _asn1_convert_integer(const char *value,unsigned char *value_out,int value_out_s #ifdef LIBTASN1_DEBUG_INTEGER - _libasn1_log("_asn1_convert_integer: valueIn=%s, lenOut=%d",value,*len); + _libtasn1_log("_asn1_convert_integer: valueIn=%s, lenOut=%d",value,*len); for(k=0;k<SIZEOF_UNSIGNED_LONG_INT;k++) - _libasn1_log(", vOut[%d]=%d",k,value_out[k]); - _libasn1_log("\n"); + _libtasn1_log(", vOut[%d]=%d",k,value_out[k]); + _libtasn1_log("\n"); #endif diff --git a/lib/errors.c b/lib/errors.c index 321cdc5..3f90e1f 100644 --- a/lib/errors.c +++ b/lib/errors.c @@ -117,7 +117,19 @@ void _libtasn1_log( const char *fmt, ...) { return; } -#endif +#else /* not DEBUG */ +# ifndef C99_MACROS + +/* Without C99 macros these functions have to + * be called. This may affect performance. + */ +void _libtasn1_null_log( void* x, ...) { return; } +# endif /* C99_MACROS */ +#endif /* DEBUG */ + + + + diff --git a/lib/errors.h b/lib/errors.h index 140e977..38395f6 100644 --- a/lib/errors.h +++ b/lib/errors.h @@ -45,8 +45,17 @@ void libtasn1_perror(int error); #ifdef LIBTASN1_DEBUG void _libtasn1_log( const char *fmt, ...); #else -# define _libtasn1_log ( ...) -#endif + +/* These macros only work with C99 compliant compilers + */ +# ifdef C99_MACROS +# define _libtasn1_log(...) +# else +# define _libtasn1_log _libtasn1_null_log +void _libtasn1_null_log( void*, ...); +# endif /* C99_MACROS */ + +#endif /* DEBUG */ #endif /* ERRORS_H */ @@ -24,9 +24,8 @@ #include <defines.h> - -#define LIBTASN1_DEBUG /* +#define LIBTASN1_DEBUG #define LIBTASN1_DEBUG_PARSER #define LIBTASN1_DEBUG_INTEGER */ |