Make debug output compile-testable even if disabled. Signed-off-by: Andreas Färber <afaer...@suse.de> --- target-unicore32/helper.c | 12 ++++++------ target-unicore32/softmmu.c | 12 ++++++------ 2 Dateien geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)
diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index 5359538..688c985 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -17,13 +17,13 @@ #include "ui/console.h" #endif -#undef DEBUG_UC32 +#define DEBUG_UC32 0 -#ifdef DEBUG_UC32 -#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__) -#else -#define DPRINTF(fmt, ...) do {} while (0) -#endif +#define DPRINTF(fmt, ...) G_STMT_START \ + if (DEBUG_UC32) { \ + printf("%s: " fmt , __func__, ## __VA_ARGS__); \ + } \ + G_STMT_END CPUUniCore32State *uc32_cpu_init(const char *cpu_model) { diff --git a/target-unicore32/softmmu.c b/target-unicore32/softmmu.c index fc27100..2ce30d9 100644 --- a/target-unicore32/softmmu.c +++ b/target-unicore32/softmmu.c @@ -14,13 +14,13 @@ #include <cpu.h> -#undef DEBUG_UC32 +#define DEBUG_UC32 0 -#ifdef DEBUG_UC32 -#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__) -#else -#define DPRINTF(fmt, ...) do {} while (0) -#endif +#define DPRINTF(fmt, ...) G_STMT_START \ + if (DEBUG_UC32) { \ + printf("%s: " fmt , __func__, ## __VA_ARGS__); \ + } \ + G_STMT_END #define SUPERPAGE_SIZE (1 << 22) #define UC32_PAGETABLE_READ (1 << 8) -- 1.7.10.4