qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 09/43] ppc: made printf always compile in debug output
@ 2017-04-01 13:44 Danil Antonov
  2017-04-02  6:44 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Danil Antonov @ 2017-04-01 13:44 UTC (permalink / raw)
  To: qemu-devel, agraf, david

>From 236c82fee189c22b88313fda71816e486edab8a6 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.anto@gmail.com>
Date: Wed, 29 Mar 2017 12:23:58 +0300
Subject: [PATCH 09/43] ppc: 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>
---
 target/ppc/kvm.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 9f1f132..5425055 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -50,15 +50,15 @@
 #include "hw/ppc/spapr_cpu_core.h"
 #endif

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

 #define PROC_DEVTREE_CPU      "/proc/device-tree/cpus/"

-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-02  6:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-01 13:44 [Qemu-devel] [PATCH 09/43] ppc: made printf always compile in debug output Danil Antonov
2017-04-02  6:44 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).