qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 04/43] xen-hvm: made printf always compile in debug


From: Danil Antonov
Subject: [Qemu-devel] [PATCH 04/43] xen-hvm: made printf always compile in debug output
Date: Sat, 1 Apr 2017 16:34:18 +0300

>From 05d558842b0a10ee3f0606eb54068b6ba03906a3 Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
Date: Wed, 29 Mar 2017 02:13:13 +0300
Subject: [PATCH 04/43] xen-hvm: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <address@hidden>
---
 xen-hvm.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen-hvm.c b/xen-hvm.c
index 5043beb..abf0f72 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -29,15 +29,15 @@
 #include <xen/hvm/params.h>
 #include <xen/hvm/e820.h>

-//#define DEBUG_XEN_HVM
-
-#ifdef DEBUG_XEN_HVM
-#define DPRINTF(fmt, ...) \
-    do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-    do { } while (0)
-#endif
+#ifndef DEBUG_XEN_HVM
+#define DEBUG_XEN_HVM 0
+#endif
+
+#define DPRINTF(fmt, ...) do {                        \
+    if (DEBUG_XEN_HVM) {                              \
+        fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \
+    }                                                 \
+} while (0);

 static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi;
 static MemoryRegion *framebuffer;
-- 
2.8.0.rc3


reply via email to

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