Wrap LOG and DBG in do { ... } while(0)

PUBLISHED_FROM=c4f3d44ed16dba60db3198b90478c1b2e6f2a5c1
This commit is contained in:
Deomid Ryabkov authored and Cesanta Bot committed 2016-10-31 20:11:37 +00:00
1 parent b39e30fb0c
commit 6a12bd7abc
1 file changed
+14 -10
+14 -10
View File
@@ -208,19 +208,23 @@ extern enum cs_log_level cs_log_level;
void cs_log_print_prefix(const char *func);
void cs_log_printf(const char *fmt, ...);
#define LOG(l, x) \
if (cs_log_level >= l) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
}
#define LOG(l, x) \
do { \
if (cs_log_level >= l) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
} \
} while (0)
#ifndef CS_NDEBUG
#define DBG(x) \
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
}
#define DBG(x) \
do { \
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
} \
} while (0)
#else /* NDEBUG */