deprecate EMIT_ASN_DEBUG, move under ASN_ namespace

This commit is contained in:
Lev Walkin 2017-10-24 00:58:42 -07:00
parent 5615304c9a
commit 9175a28a5a
7 changed files with 18 additions and 13 deletions

View File

@ -40,8 +40,8 @@ AC_ARG_ENABLE([ASN_DEBUG],
[produce debug log during `make check` testing])],
[enable_asn_debug=$enableval], [enable_asn_debug=no])
AS_IF([test x$enable_asn_debug != xno], [
TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG"
SKELETONS_CFLAGS="-DEMIT_ASN_DEBUG"
TESTSUITE_CFLAGS="-DASN_EMIT_DEBUG"
SKELETONS_CFLAGS="-DASN_EMIT_DEBUG"
])
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])

View File

@ -31,12 +31,17 @@ int get_asn1c_environment_version(void); /* Run-time version */
#define asn_debug_indent 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.
* You may enable or override it.
*/
#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
#ifdef ASN_THREAD_SAFE
/* Thread safety requires sacrifice in output indentation:
@ -58,13 +63,13 @@ int asn_debug_indent;
void CC_PRINTFLIKE(1, 2) ASN_DEBUG_f(const char *fmt, ...);
#define ASN_DEBUG ASN_DEBUG_f
#endif /* C99 */
#else /* EMIT_ASN_DEBUG != 1 */
#else /* ASN_EMIT_DEBUG != 1 */
#if __STDC_VERSION__ >= 199901L
#define ASN_DEBUG(...) do{}while(0)
#else /* not C99 */
static void CC_PRINTFLIKE(1, 2) ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
#endif /* C99 or better */
#endif /* EMIT_ASN_DEBUG */
#endif /* ASN_EMIT_DEBUG */
#endif /* ASN_DEBUG */
/*

View File

@ -42,7 +42,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
(void)app_key;
assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
unsigned char *b, *bend;
b = buf + buf_offset;
bend = b + size;
@ -140,7 +140,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
fbuf_chunk < fbuf_left
? fbuf_chunk : fbuf_left,
fbuf_left);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
if(st) {
fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st);

View File

@ -42,7 +42,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
(void)app_key;
assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
unsigned char *b, *bend;
b = buf + buf_offset;
bend = b + size;
@ -140,7 +140,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
fbuf_chunk < fbuf_left
? fbuf_chunk : fbuf_left,
fbuf_left);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
if(st) {
fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st);

View File

@ -32,7 +32,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
(void)app_key;
assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
unsigned char *b, *bend;
b = buf + buf_offset;
bend = b + size;
@ -122,7 +122,7 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty
? fbuf_chunk : fbuf_left,
fbuf_left,
fname);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
if(st) {
fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st);

View File

@ -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_left);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
if(st) {
fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st);

View File

@ -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_left);
#ifdef EMIT_ASN_DEBUG
#ifdef ASN_EMIT_DEBUG
if(st) {
fprintf(stderr, "=== currently ===\n");
asn_fprint(stderr, &asn_DEF_PDU, st);