From patchwork Sun Jan 27 13:32:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [RFC,19/19] target-unicore32: Refactor debug output macros From: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 216007 Message-Id: <1359293537-8251-20-git-send-email-afaerber@suse.de> To: qemu-devel@nongnu.org Cc: Guan Xuetao , =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 27 Jan 2013 14:32:17 +0100 Make debug output compile-testable even if disabled. Signed-off-by: Andreas Färber --- 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 -#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)