From a935791d54078f43209ffbc1886ac5e68772ce34 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Wed, 19 May 2021 11:09:49 -0400 Subject: Rework and make DEBUG macros consistent. Remove unused -DCONF_DEBUG and -DBN_CTX_DEBUG. Rename REF_PRINT to REF_DEBUG for consistency, and add a new tracing category and use it for printing reference counts. Rename -DDEBUG_UNUSED to -DUNUSED_RESULT_DEBUG Fix BN_DEBUG_RAND so it compiles and, when set, force DEBUG_RAND to be set also. Rename engine_debug_ref to be ENGINE_REF_PRINT also for consistency. Fixes #15357 Reviewed-by: Tomas Mraz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/15353) --- include/internal/refcount.h | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'include/internal/refcount.h') diff --git a/include/internal/refcount.h b/include/internal/refcount.h index ee506e592d..7412d62f56 100644 --- a/include/internal/refcount.h +++ b/include/internal/refcount.h @@ -11,13 +11,7 @@ # pragma once # include - -/* Used to checking reference counts, most while doing perl5 stuff :-) */ -# if defined(OPENSSL_NO_STDIO) -# if defined(REF_PRINT) -# error "REF_PRINT requires stdio" -# endif -# endif +# include # ifndef OPENSSL_DEV_NO_ATOMICS # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ @@ -176,11 +170,9 @@ typedef int CRYPTO_REF_COUNT; # define REF_ASSERT_ISNT(i) # endif -# ifdef REF_PRINT -# define REF_PRINT_COUNT(a, b) \ - fprintf(stderr, "%p:%4d:%s\n", (void*)b, b->references, a) -# else -# define REF_PRINT_COUNT(a, b) -# endif +# define REF_PRINT_EX(text, count, object) \ + OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text)); +# define REF_PRINT_COUNT(text, object) \ + REF_PRINT_EX(text, object->references, (void *)object) #endif -- cgit v1.2.3