Patchwork [v2,11/15] target-openrisc: Refactor debug output macros

login
register
mail settings
Submitter Andreas Färber
Date Feb. 21, 2013, 4:25 a.m.
Message ID <1361420711-15698-12-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/222182/
State New
Headers show

Comments

Andreas Färber - Feb. 21, 2013, 4:25 a.m.
Debug output is already enabled and thus compile-testable, but align
with other targets.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-openrisc/translate.c |   14 ++++++++++++--
 1 Datei geändert, 12 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

Patch

diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
index 1e1b30c..2b6f19c 100644
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -34,11 +34,21 @@ 
 #define OPENRISC_DISAS
 
 #ifdef OPENRISC_DISAS
-#  define LOG_DIS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__)
+static const bool debug_disas = true;
 #else
-#  define LOG_DIS(...) do { } while (0)
+static const bool debug_disas;
 #endif
 
+static void GCC_FMT_ATTR(1, 2) LOG_DIS(const char *fmt, ...)
+{
+    if (debug_disas) {
+        va_list ap;
+        va_start(ap, fmt);
+        qemu_log_mask_vprintf(CPU_LOG_TB_IN_ASM, fmt, ap);
+        va_end(ap);
+    }
+}
+
 typedef struct DisasContext {
     TranslationBlock *tb;
     target_ulong pc, ppc, npc;