[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 38/43] empty_slot: made printf always compile in deb
From: |
Danil Antonov |
Subject: |
[Qemu-devel] [PATCH 38/43] empty_slot: made printf always compile in debug output |
Date: |
Sat, 1 Apr 2017 17:07:39 +0300 |
>From f91f364efb44edd51e865872eeb1bc2293d42930 Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
Date: Wed, 29 Mar 2017 12:42:32 +0300
Subject: [PATCH 38/43] empty_slot: 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 <address@hidden>
---
hw/core/empty_slot.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/core/empty_slot.c b/hw/core/empty_slot.c
index c1b9c2b..b58957d 100644
--- a/hw/core/empty_slot.c
+++ b/hw/core/empty_slot.c
@@ -16,12 +16,15 @@
//#define DEBUG_EMPTY_SLOT
-#ifdef DEBUG_EMPTY_SLOT
-#define DPRINTF(fmt, ...) \
- do { printf("empty_slot: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_EMPTY_SLOT
+#define DEBUG_EMPTY_SLOT 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+ if (DEBUG_EMPTY_SLOT) { \
+ fprintf(stderr, "empty_slot: " fmt , ## __VA_ARGS__); \
+ } \
+} while (0);
#define TYPE_EMPTY_SLOT "empty_slot"
#define EMPTY_SLOT(obj) OBJECT_CHECK(EmptySlot, (obj), TYPE_EMPTY_SLOT)
--
2.8.0.rc3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 38/43] empty_slot: made printf always compile in debug output,
Danil Antonov <=