From b82743612f46204cbdaf48b5f5e8c939da70cabd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 20 Jun 2016 22:38:54 -0600 Subject: [PATCH] Even the 'unconditional' _alert() macro should be disabled if all debug features are disabled. --- include/debug.h | 20 ++++++++++++-------- libc/misc/lib_debug.c | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/debug.h b/include/debug.h index 2ef9574171..d9286224d1 100644 --- a/include/debug.h +++ b/include/debug.h @@ -113,29 +113,33 @@ # define __arch_syslog syslog #endif -#define _alert(format, ...) \ +#ifdef CONFIG_DEBUG_FEATURES +# define _alert(format, ...) \ __arch_syslog(LOG_EMERG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) +#else /* CONFIG_DEBUG_ERROR */ +# define _alert(x...) +#endif #ifdef CONFIG_DEBUG_ERROR # define _err(format, ...) \ __arch_syslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) -#else /* CONFIG_DEBUG_ERROR */ +#else # define _err(x...) #endif #ifdef CONFIG_DEBUG_WARN # define _warn(format, ...) \ __arch_syslog(LOG_WARNING, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) -#else /* CONFIG_DEBUG_INFO */ +#else # define _warn(x...) -#endif /* CONFIG_DEBUG_INFO */ +#endif #ifdef CONFIG_DEBUG_INFO # define _info(format, ...) \ __arch_syslog(LOG_INFO, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) -#else /* CONFIG_DEBUG_INFO */ +#else # define _info(x...) -#endif /* CONFIG_DEBUG_INFO */ +#endif /* Subsystem specific debug */ @@ -665,7 +669,7 @@ /* Variadic macros NOT supported */ -#ifndef CONFIG_ARCH_LOWPUTC +#ifndef CONFIG_DEBUG_FEATURES # define _alert (void) # endif @@ -1479,7 +1483,7 @@ void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, */ #ifndef CONFIG_CPP_HAVE_VARARGS -#ifndef CONFIG_ARCH_LOWPUTC +#ifndef CONFIG_DEBUG_FEATURES int _alert(const char *format, ...); #endif diff --git a/libc/misc/lib_debug.c b/libc/misc/lib_debug.c index d921c7c32a..0bc5d81bf6 100644 --- a/libc/misc/lib_debug.c +++ b/libc/misc/lib_debug.c @@ -59,7 +59,7 @@ * ****************************************************************************/ -#ifdef CONFIG_ARCH_LOWPUTC +#ifdef CONFIG_DEBUG_FEATURES int _alert(const char *format, ...) { va_list ap; @@ -71,7 +71,7 @@ int _alert(const char *format, ...) return ret; } -#endif /* CONFIG_ARCH_LOWPUTC */ +#endif /* CONFIG_DEBUG_FEATURES */ #ifdef CONFIG_DEBUG_ERROR int _err(const char *format, ...)