Commit 9175a28a authored by Lev Walkin's avatar Lev Walkin

deprecate EMIT_ASN_DEBUG, move under ASN_ namespace

parent 5615304c
...@@ -40,8 +40,8 @@ AC_ARG_ENABLE([ASN_DEBUG], ...@@ -40,8 +40,8 @@ AC_ARG_ENABLE([ASN_DEBUG],
[produce debug log during `make check` testing])], [produce debug log during `make check` testing])],
[enable_asn_debug=$enableval], [enable_asn_debug=no]) [enable_asn_debug=$enableval], [enable_asn_debug=no])
AS_IF([test x$enable_asn_debug != xno], [ AS_IF([test x$enable_asn_debug != xno], [
TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG" TESTSUITE_CFLAGS="-DASN_EMIT_DEBUG"
SKELETONS_CFLAGS="-DEMIT_ASN_DEBUG" SKELETONS_CFLAGS="-DASN_EMIT_DEBUG"
]) ])
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
......
...@@ -31,12 +31,17 @@ int get_asn1c_environment_version(void); /* Run-time version */ ...@@ -31,12 +31,17 @@ int get_asn1c_environment_version(void); /* Run-time version */
#define asn_debug_indent 0 #define asn_debug_indent 0
#define ASN_DEBUG_INDENT_ADD(i) do{}while(0) #define ASN_DEBUG_INDENT_ADD(i) do{}while(0)
#ifdef EMIT_ASN_DEBUG
#warning "Use ASN_EMIT_DEBUG instead of EMIT_ASN_DEBUG"
#define ASN_EMIT_DEBUG EMIT_ASN_DEBUG
#endif
/* /*
* A macro for debugging the ASN.1 internals. * A macro for debugging the ASN.1 internals.
* You may enable or override it. * You may enable or override it.
*/ */
#ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */ #ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */
#if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */ #if ASN_EMIT_DEBUG == 1 /* And it was asked to emit this code... */
#if __STDC_VERSION__ >= 199901L #if __STDC_VERSION__ >= 199901L
#ifdef ASN_THREAD_SAFE #ifdef ASN_THREAD_SAFE
/* Thread safety requires sacrifice in output indentation: /* Thread safety requires sacrifice in output indentation:
...@@ -58,13 +63,13 @@ int asn_debug_indent; ...@@ -58,13 +63,13 @@ int asn_debug_indent;
void CC_PRINTFLIKE(1, 2) ASN_DEBUG_f(const char *fmt, ...); void CC_PRINTFLIKE(1, 2) ASN_DEBUG_f(const char *fmt, ...);
#define ASN_DEBUG ASN_DEBUG_f #define ASN_DEBUG ASN_DEBUG_f
#endif /* C99 */ #endif /* C99 */
#else /* EMIT_ASN_DEBUG != 1 */ #else /* ASN_EMIT_DEBUG != 1 */
#if __STDC_VERSION__ >= 199901L #if __STDC_VERSION__ >= 199901L
#define ASN_DEBUG(...) do{}while(0) #define ASN_DEBUG(...) do{}while(0)
#else /* not C99 */ #else /* not C99 */
static void CC_PRINTFLIKE(1, 2) ASN_DEBUG(const char *fmt, ...) { (void)fmt; } static void CC_PRINTFLIKE(1, 2) ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
#endif /* C99 or better */ #endif /* C99 or better */
#endif /* EMIT_ASN_DEBUG */ #endif /* ASN_EMIT_DEBUG */
#endif /* ASN_DEBUG */ #endif /* ASN_DEBUG */
/* /*
......
...@@ -42,7 +42,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) { ...@@ -42,7 +42,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
unsigned char *b, *bend; unsigned char *b, *bend;
b = buf + buf_offset; b = buf + buf_offset;
bend = b + size; bend = b + size;
...@@ -140,7 +140,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char ...@@ -140,7 +140,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
fbuf_chunk < fbuf_left fbuf_chunk < fbuf_left
? fbuf_chunk : fbuf_left, ? fbuf_chunk : fbuf_left,
fbuf_left); fbuf_left);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
if(st) { if(st) {
fprintf(stderr, "=== currently ===\n"); fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st); asn_fprint(stderr, &asn_DEF_PDU, st);
......
...@@ -42,7 +42,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) { ...@@ -42,7 +42,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
unsigned char *b, *bend; unsigned char *b, *bend;
b = buf + buf_offset; b = buf + buf_offset;
bend = b + size; bend = b + size;
...@@ -140,7 +140,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char ...@@ -140,7 +140,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
fbuf_chunk < fbuf_left fbuf_chunk < fbuf_left
? fbuf_chunk : fbuf_left, ? fbuf_chunk : fbuf_left,
fbuf_left); fbuf_left);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
if(st) { if(st) {
fprintf(stderr, "=== currently ===\n"); fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st); asn_fprint(stderr, &asn_DEF_PDU, st);
......
...@@ -32,7 +32,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) { ...@@ -32,7 +32,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
unsigned char *b, *bend; unsigned char *b, *bend;
b = buf + buf_offset; b = buf + buf_offset;
bend = b + size; bend = b + size;
...@@ -122,7 +122,7 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty ...@@ -122,7 +122,7 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty
? fbuf_chunk : fbuf_left, ? fbuf_chunk : fbuf_left,
fbuf_left, fbuf_left,
fname); fname);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
if(st) { if(st) {
fprintf(stderr, "=== currently ===\n"); fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st); asn_fprint(stderr, &asn_DEF_PDU, st);
......
...@@ -118,7 +118,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size, ...@@ -118,7 +118,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size,
fbuf_chunk < fbuf_left fbuf_chunk < fbuf_left
? fbuf_chunk : fbuf_left, ? fbuf_chunk : fbuf_left,
fbuf_left); fbuf_left);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
if(st) { if(st) {
fprintf(stderr, "=== currently ===\n"); fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st); asn_fprint(stderr, &asn_DEF_PDU, st);
......
...@@ -112,7 +112,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size, ...@@ -112,7 +112,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size,
fbuf_chunk < fbuf_left fbuf_chunk < fbuf_left
? fbuf_chunk : fbuf_left, ? fbuf_chunk : fbuf_left,
fbuf_left); fbuf_left);
#ifdef EMIT_ASN_DEBUG #ifdef ASN_EMIT_DEBUG
if(st) { if(st) {
fprintf(stderr, "=== currently ===\n"); fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st); asn_fprint(stderr, &asn_DEF_PDU, st);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment