summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Fiorina <fiorinaf@gnutls.org>2002-10-09 20:19:23 +0000
committerFabio Fiorina <fiorinaf@gnutls.org>2002-10-09 20:19:23 +0000
commit6a27efc885b5975c1688573db640c672ab803116 (patch)
tree530efe5ef319bf000d32629894de6e624f71550d
parenta7ebd7b492debee64c68847f5c8cd97f2c2e2882 (diff)
downloadlibtasn1-6a27efc885b5975c1688573db640c672ab803116.tar.gz
-rw-r--r--configure.in19
-rw-r--r--lib/ASN1.c4
-rw-r--r--lib/ASN1.y4
-rw-r--r--lib/element.c6
-rw-r--r--lib/errors.c14
-rw-r--r--lib/errors.h13
-rw-r--r--lib/int.h3
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)
diff --git a/lib/ASN1.c b/lib/ASN1.c
index c706e3a..7094ade 100644
--- a/lib/ASN1.c
+++ b/lib/ASN1.c
@@ -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
diff --git a/lib/ASN1.y b/lib/ASN1.y
index 45dcb73..e26f3e7 100644
--- a/lib/ASN1.y
+++ b/lib/ASN1.y
@@ -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 */
diff --git a/lib/int.h b/lib/int.h
index 7ebf51f..3219ec2 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -24,9 +24,8 @@
#include <defines.h>
-
-#define LIBTASN1_DEBUG
/*
+#define LIBTASN1_DEBUG
#define LIBTASN1_DEBUG_PARSER
#define LIBTASN1_DEBUG_INTEGER
*/