From: Danil Antonov <g.danil.anto@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 25/43] kvm-all: made printf always compile in debug output
Date: Sat, 1 Apr 2017 16:59:37 +0300 [thread overview]
Message-ID: <CA+KKJYAdwLrCGKxrurARb5M1DQgHiEUFq587Enes8D5HFhvkxA@mail.gmail.com> (raw)
>From f818d3ef7db8cc5b99656fd1059c0d7d07dea571 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.anto@gmail.com>
Date: Wed, 29 Mar 2017 12:35:36 +0300
Subject: [PATCH 25/43] kvm-all: 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>
---
kvm-all.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 90b8573..47940b5 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -50,16 +50,16 @@
*/
#define PAGE_SIZE getpagesize()
-//#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_MSI_HASHTAB_SIZE 256
struct KVMParkedVcpu {
--
2.8.0.rc3
reply other threads:[~2017-04-01 13:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CA+KKJYAdwLrCGKxrurARb5M1DQgHiEUFq587Enes8D5HFhvkxA@mail.gmail.com \
--to=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 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).