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

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

diff --git a/xen-mapcache.c b/xen-mapcache.c
index 1a96d2e..c2d1e6f 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -22,15 +22,15 @@
 #include "trace-root.h"


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

 #if HOST_LONG_BITS == 32
 #  define MCACHE_BUCKET_SHIFT 16
-- 
2.8.0.rc3

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

only message in thread, other threads:[~2017-04-01 13:35 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:35 [Qemu-devel] [PATCH 05/43] xen-mapcache: made printf always compile in debug 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.