All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, agraf@suse.de,
	Danil Antonov <g.danil.anto@gmail.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PATCH for-2.10 02/10] s390x/kvm: make printf always compile in debug output
Date: Thu,  6 Apr 2017 13:16:38 +0200	[thread overview]
Message-ID: <20170406111646.12624-3-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20170406111646.12624-1-cornelia.huck@de.ibm.com>

From: Danil Antonov <g.danil.anto@gmail.com>

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>
Message-Id: <CA+KKJYAhsuTodm3s2rK65hR=-Xi5+Z7Q+M2nJYZQf2wa44HfOg@mail.gmail.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 target/s390x/kvm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index ac47154b83..1a249d8359 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -47,16 +47,16 @@
 #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)
+#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.11.0

  parent reply	other threads:[~2017-04-06 11:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 11:16 [Qemu-devel] [PATCH for-2.10 00/10] s390x queue for 2.10 Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 01/10] s390x: introduce 2.10 compat machine Cornelia Huck
2017-04-06 11:16 ` Cornelia Huck [this message]
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 03/10] s390x/pci: make printf always compile in debug output Cornelia Huck
2017-04-06 12:15   ` Thomas Huth
2017-04-06 13:07     ` Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 04/10] s390x/css: introduce read-only property type for device ids Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 05/10] s390x/css: provide introspection for virtual subchannel and device busid Cornelia Huck
2017-04-06 12:19   ` Thomas Huth
2017-04-06 13:16     ` Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 06/10] s390x/css: consolidate the devno property for ccw devices Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 07/10] s390x: use enum for adapter type and standardize its naming Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 08/10] s390x: initialize flic before I/O subsystems Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 09/10] s390x/flic: cache flic in s390_get_flic Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 10/10] s390x: register I/O adapters per ISC during init Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170406111646.12624-3-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=g.danil.anto@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.