All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 03/43] xen-common: made printf always compile in debug output
@ 2017-04-01 13:32 Danil Antonov
  0 siblings, 0 replies; only message in thread
From: Danil Antonov @ 2017-04-01 13:32 UTC (permalink / raw)
  To: qemu-devel, sstabellini

>From 0e3f1f202ebbf14259dee89e523c1fbc6f08d4ed Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.anto@gmail.com>
Date: Wed, 29 Mar 2017 02:12:31 +0300
Subject: [PATCH 03/43] xen-common: 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 <g.danil.anto@gmail.com>
---
 xen-common.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen-common.c b/xen-common.c
index fd2c928..9361974 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -15,15 +15,15 @@
 #include "sysemu/accel.h"
 #include "migration/migration.h"

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

 static int store_dev_info(int domid, Chardev *cs, const char *string)
 {
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-01 13:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 13:32 [Qemu-devel] [PATCH 03/43] xen-common: made printf always compile in debug output Danil Antonov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.