[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 19/19] target-unicore32: Refactor debug output macros
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [RFC 19/19] target-unicore32: Refactor debug output macros |
Date: |
Sun, 27 Jan 2013 14:32:17 +0100 |
Make debug output compile-testable even if disabled.
Signed-off-by: Andreas Färber <address@hidden>
---
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
- Re: [Qemu-devel] [RFC 16/19] target-ppc: Refactor debug output macros, (continued)
[Qemu-devel] [PATCH RESEND for-1.4? 08/19] target-cris/helper.c: Update Coding Style, Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH for-1.4 04/19] target-ppc: Fix build for PPC_DEBUG_DISAS, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 11/19] target-cris: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 13/19] target-lm32: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 12/19] target-i386: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 18/19] target-sparc: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 15/19] target-openrisc: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 19/19] target-unicore32: Refactor debug output macros,
Andreas Färber <=