[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 21/43] s390: made printf always compile in debug out
From: |
Danil Antonov |
Subject: |
[Qemu-devel] [PATCH 21/43] s390: made printf always compile in debug output |
Date: |
Sat, 1 Apr 2017 16:56:30 +0300 |
>From cbc3425092b6ee94d6666365f8714a39af5a583a Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
Date: Wed, 29 Mar 2017 12:33:01 +0300
Subject: [PATCH 21/43] s390: 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/s390x/s390-pci-bus.c | 18 +++++++++++-------
hw/s390x/s390-pci-inst.c | 18 +++++++++++-------
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 69b0291..6dd9bca 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -24,13 +24,17 @@
#include "qemu/error-report.h"
/* #define DEBUG_S390PCI_BUS */
-#ifdef DEBUG_S390PCI_BUS
-#define DPRINTF(fmt, ...) \
- do { fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
- do { } while (0)
-#endif
+
+#ifndef DEBUG_S390PCI_BUS
+#define DEBUG_S390PCI_BUS 0
+#endif
+
+#define DPRINTF(fmt, ...) \
+ do { \
+ if (DEBUG_S390PCI_BUS) { \
+ fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
S390pciState *s390_get_phb(void)
{
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index d2a8c0a..82b5617 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -21,13 +21,17 @@
#include "sysemu/hw_accel.h"
/* #define DEBUG_S390PCI_INST */
-#ifdef DEBUG_S390PCI_INST
-#define DPRINTF(fmt, ...) \
- do { fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
- do { } while (0)
-#endif
+
+#ifndef DEBUG_S390PCI_INST
+#define DEBUG_S390PCI_INST 0
+#endif
+
+#define DPRINTF(fmt, ...) \
+ do { \
+ if (DEBUG_S390PCI_INST) { \
+ fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
static void s390_set_status_code(CPUS390XState *env,
uint8_t r, uint64_t status_code)
--
2.8.0.rc3
- [Qemu-devel] [PATCH 21/43] s390: made printf always compile in debug output,
Danil Antonov <=