All of lore.kernel.org
 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

* Re: [Qemu-devel] [PATCH 09/43] ppc: made printf always compile in debug output
  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
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-04-02  6:44 UTC (permalink / raw)
  To: Danil Antonov; +Cc: qemu-devel, agraf

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

On Sat, Apr 01, 2017 at 04:44:36PM +0300, Danil Antonov wrote:
> >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>

Hrm.  Long term we really wantto change these to tracepoints anyway,
so I'm not sure how useful this is on its own.  I'd apply it anyway,
except it no longer applies clear against ppc-for-2.10.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[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 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.