>From fafbd66ef7cd5e2295a5c14e24a6ec1520ca79f4 Mon Sep 17 00:00:00 2001 From: Danil Antonov <g.danil.a...@gmail.com> 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 <g.danil.a...@gmail.com> --- 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