From 47c3179fb2dc5af83d776d1fd6c06cc468fc9264 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 6 Oct 2011 03:48:04 +0200 Subject: [PATCH] improve debugging macro --- netifd.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netifd.h b/netifd.h index a368d9b..1bb3820 100644 --- a/netifd.h +++ b/netifd.h @@ -23,7 +23,10 @@ enum { #ifdef DEBUG #define DPRINTF(format, ...) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__) -#define D(level, format, ...) if (debug_mask & (1 << (DEBUG_ ## level))) DPRINTF(format, ##__VA_ARGS__) +#define D(level, format, ...) do { \ + if (debug_mask & (1 << (DEBUG_ ## level))) \ + DPRINTF(format, ##__VA_ARGS__); \ + } while (0) #else #define DPRINTF(format, ...) no_debug(0, format, ## __VA_ARGS__) #define D(level, format, ...) no_debug(DEBUG_ ## level, format, ## __VA_ARGS__) -- 2.25.1