All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 10/43] s390x: made printf always compile in debug output
@ 2017-04-01 13:45 Danil Antonov
  2017-04-03  8:34 ` Cornelia Huck
  0 siblings, 1 reply; 2+ messages in thread
From: Danil Antonov @ 2017-04-01 13:45 UTC (permalink / raw)
  To: qemu-devel, borntraeger, cornelia.huck, agraf, rth

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

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index ac47154..ac994fe 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -47,15 +47,15 @@
 #include "exec/memattrs.h"
 #include "hw/s390x/s390-virtio-ccw.h"

-/* #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 kvm_vm_check_mem_attr(s, attr) \
     kvm_vm_check_attr(s, KVM_S390_VM_MEM_CTRL, attr)
-- 
2.8.0.rc3

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

* Re: [Qemu-devel] [PATCH 10/43] s390x: made printf always compile in debug output
  2017-04-01 13:45 [Qemu-devel] [PATCH 10/43] s390x: made printf always compile in debug output Danil Antonov
@ 2017-04-03  8:34 ` Cornelia Huck
  0 siblings, 0 replies; 2+ messages in thread
From: Cornelia Huck @ 2017-04-03  8:34 UTC (permalink / raw)
  To: Danil Antonov; +Cc: qemu-devel, borntraeger, agraf, rth

On Sat, 1 Apr 2017 16:45:53 +0300
Danil Antonov <g.danil.anto@gmail.com> wrote:

> From ea9cd8f02bd98548435f561e62f4f9b672318bcb Mon Sep 17 00:00:00 2001
> From: Danil Antonov <g.danil.anto@gmail.com>
> Date: Wed, 29 Mar 2017 12:26:05 +0300
> Subject: [PATCH 10/43] s390x: made printf always compile in debug output

s/made/make/

(Not sure where the headers above came from; might be gmail.)

> 
> 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/s390x/kvm.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

Seems reasonable; although we should convert to tracepoints later.

Queued for 2.10 (with the commit message slightly tweaked).

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

end of thread, other threads:[~2017-04-03  8:34 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:45 [Qemu-devel] [PATCH 10/43] s390x: made printf always compile in debug output Danil Antonov
2017-04-03  8:34 ` Cornelia Huck

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.