[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 40/43] mips: made printf always compile in debug out
From: |
Danil Antonov |
Subject: |
[Qemu-devel] [PATCH 40/43] mips: made printf always compile in debug output |
Date: |
Sat, 1 Apr 2017 17:08:16 +0300 |
>From fafbd66ef7cd5e2295a5c14e24a6ec1520ca79f4 Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
Date: Wed, 29 Mar 2017 12:43:28 +0300
Subject: [PATCH 40/43] mips: 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/mips/gt64xxx_pci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 4811843..adb64ff 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -30,13 +30,16 @@
#include "hw/i386/pc.h"
#include "exec/address-spaces.h"
-//#define DEBUG
-#ifdef DEBUG
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__,
##__VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+ if (DEBUG) { \
+ fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
+ } \
+} while (0);
#define GT_REGS (0x1000 >> 2)
--
2.8.0.rc3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 40/43] mips: made printf always compile in debug output,
Danil Antonov <=