qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 02/14] i386: Convert conditional compilation of debu


From: Marc Marí
Subject: [Qemu-devel] [PATCH 02/14] i386: Convert conditional compilation of debug printfs to regular ifs
Date: Mon, 28 Apr 2014 10:26:03 +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/i386/kvm/pci-assign.c |   18 ++++++++++--------
 hw/i386/multiboot.c      |   15 ++++++++++-----
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index a825871..83f2151 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -48,17 +48,19 @@
 #define IORESOURCE_PREFETCH 0x00002000  /* No side effects */
 #define IORESOURCE_MEM_64   0x00100000
 
-//#define DEVICE_ASSIGNMENT_DEBUG
+//#define DEVICE_ASSIGNMENT_DEBUG 1
 
-#ifdef DEVICE_ASSIGNMENT_DEBUG
-#define DEBUG(fmt, ...)                                       \
-    do {                                                      \
-        fprintf(stderr, "%s: " fmt, __func__ , __VA_ARGS__);  \
-    } while (0)
-#else
-#define DEBUG(fmt, ...)
+#ifndef DEVICE_ASSIGNMENT_DEBUG
+#define DEVICE_ASSIGNMENT_DEBUG 0
 #endif
 
+#define DEBUG(fmt, ...)                                           \
+    do {                                                          \
+        if(DEVICE_ASSIGNMENT_DEBUG) {                             \
+            fprintf(stderr, "%s: " fmt, __func__ , __VA_ARGS__);  \
+        }                                                         \
+    } while (0)
+
 typedef struct PCIRegion {
     int type;           /* Memory or port I/O */
     int valid;
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 985ca1e..3acab60 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -30,14 +30,19 @@
 #include "sysemu/sysemu.h"
 
 /* Show multiboot debug output */
-//#define DEBUG_MULTIBOOT
+//#define DEBUG_MULTIBOOT 1
 
-#ifdef DEBUG_MULTIBOOT
-#define mb_debug(a...) fprintf(stderr, ## a)
-#else
-#define mb_debug(a...)
+#ifndef DEBUG_MULTIBOOT
+#define DEBUG_MULTIBOOT 0
 #endif
 
+#define mb_debug(a...) \
+    do { \
+        if(DEBUG_MULTIBOOT) { \
+            fprintf(stderr, ## a); \
+        } \
+    } while(0)
+
 #define MULTIBOOT_STRUCT_ADDR 0x9000
 
 #if MULTIBOOT_STRUCT_ADDR > 0xf0000
-- 
1.7.10.4




reply via email to

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