Modify debug macros to have the same format through the codebase and use regular
ifs instead of ifdef.
Signed-off-by: Marc Marí <marc.mari.barc...@gmail.com>
---
hw/s390x/s390-virtio-bus.c | 9 +++++----
hw/s390x/s390-virtio.c | 9 +++++----
target-s390x/helper.c | 23 +++++++++++++++--------
target-s390x/kvm.c | 9 +++++----
4 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index 9c71afa..2a1799e 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -38,13 +38,14 @@
/* #define DEBUG_S390 */
#ifdef DEBUG_S390
-#define DPRINTF(fmt, ...) \
- do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
+#define DEBUG_S390_ENABLED 1
#else
-#define DPRINTF(fmt, ...) \
- do { } while (0)
+#define DEBUG_S390_ENABLED 0
#endif
+#define DPRINTF(fmt, ...) \
+ QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virtio bus", fmt, ## __VA_ARGS__)
+
#define VIRTIO_EXT_CODE 0x2603
static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index aef2003..b69afb4 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -42,13 +42,14 @@
//#define DEBUG_S390
#ifdef DEBUG_S390
-#define DPRINTF(fmt, ...) \
- do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
+#define DEBUG_S390_ENABLED 1
#else
-#define DPRINTF(fmt, ...) \
- do { } while (0)
+#define DEBUG_S390_ENABLED 0
#endif
+#define DPRINTF(fmt, ...) \
+ QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virtio", fmt, ## __VA_ARGS__)
+
#define MAX_BLK_DEVS 10
#define ZIPL_FILENAME "s390-zipl.rom"
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 7c76fc1..c2aa568 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -30,19 +30,26 @@
//#define DEBUG_S390_STDOUT
#ifdef DEBUG_S390
-#ifdef DEBUG_S390_STDOUT
-#define DPRINTF(fmt, ...) \
- do { fprintf(stderr, fmt, ## __VA_ARGS__); \
- qemu_log(fmt, ##__VA_ARGS__); } while (0)
+#define DEBUG_S390_ENABLED 1
#else
-#define DPRINTF(fmt, ...) \
- do { qemu_log(fmt, ## __VA_ARGS__); } while (0)
+#define DEBUG_S390_ENABLED 0
#endif
+
+#ifdef DEBUG_S390_STDOUT