[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 43/43] ssi: made printf always compile in debug outp
From: |
Danil Antonov |
Subject: |
[Qemu-devel] [PATCH 43/43] ssi: made printf always compile in debug output |
Date: |
Sat, 1 Apr 2017 17:09:59 +0300 |
>From 0bf08ebad3ccfe3e07920f53a304478e1e3b5813 Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
Date: Wed, 29 Mar 2017 12:44:25 +0300
Subject: [PATCH 43/43] ssi: 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/ssi/pl022.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c
index c136801..bf1cc3a 100644
--- a/hw/ssi/pl022.c
+++ b/hw/ssi/pl022.c
@@ -12,18 +12,22 @@
#include "hw/ssi/ssi.h"
#include "qemu/log.h"
-//#define DEBUG_PL022 1
-
-#ifdef DEBUG_PL022
-#define DPRINTF(fmt, ...) \
-do { printf("pl022: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#ifndef DEBUG_PL022
+#define DEBUG_PL022 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+ if (DEBUG_PL022) { \
+ fprintf(stderr, "pl022: " fmt , ## __VA_ARGS__); \
+ } \
+} while (0);
+
+#define BADF(fmt, ...) do { \
+ fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); \
+ if (DEBUG_PL022) { \
+ exit(1); \
+ } \
+} while (0);
#define PL022_CR1_LBM 0x01
#define PL022_CR1_SSE 0x02
--
2.8.0.rc3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 43/43] ssi: made printf always compile in debug output,
Danil Antonov <=