qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/14] pci-host: Convert conditional compilation of


From: Marc Marí
Subject: [Qemu-devel] [PATCH 05/14] pci-host: Convert conditional compilation of debug printfs to regular ifs
Date: Mon, 28 Apr 2014 10:26:06 +0200

From: Marc Marí <address@hidden>

Modify debug macros as explained in 
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg03642.html

Signed-off-by: Marc Marí <address@hidden>
---
 hw/pci-host/bonito.c  |   15 ++++++++++-----
 hw/pci-host/ppce500.c |   15 +++++++++++----
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 902441f..cfd4dc4 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -47,14 +47,19 @@
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
 
-//#define DEBUG_BONITO
+//#define DEBUG_BONITO 1
 
-#ifdef DEBUG_BONITO
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, 
##__VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
+#ifndef DEBUG_BONITO
+#define DEBUG_BONITO 0
 #endif
 
+#define DPRINTF(fmt, ...) \
+    do { \
+        if(DEBUG_BONITO) { \
+            fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
+        } \
+    } while(0)
+
 /* from linux soure code. include/asm-mips/mips-boards/bonito64.h*/
 #define BONITO_BOOT_BASE        0x1fc00000
 #define BONITO_BOOT_SIZE        0x00100000
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index c80b7cb..4bfc212 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -21,12 +21,19 @@
 #include "qemu/bswap.h"
 #include "hw/pci-host/ppce500.h"
 
-#ifdef DEBUG_PCI
-#define pci_debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
-#else
-#define pci_debug(fmt, ...)
+//#define DEBUG_PCI 1
+
+#ifndef DEBUG_PCI
+#define DEBUG_PCI 0
 #endif
 
+#define pci_debug(fmt, ...) \
+    do { \
+        if(DEBUG_PCI) { \
+            fprintf(stderr, fmt, ## __VA_ARGS__); \
+        } \
+    } while(0)
+
 #define PCIE500_CFGADDR       0x0
 #define PCIE500_CFGDATA       0x4
 #define PCIE500_REG_BASE      0xC00
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]