>From 0e3f1f202ebbf14259dee89e523c1fbc6f08d4ed Mon Sep 17 00:00:00 2001 From: Danil Antonov <g.danil.a...@gmail.com> Date: Wed, 29 Mar 2017 02:12:31 +0300 Subject: [PATCH 03/43] xen-common: 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> --- xen-common.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen-common.c b/xen-common.c index fd2c928..9361974 100644 --- a/xen-common.c +++ b/xen-common.c @@ -15,15 +15,15 @@ #include "sysemu/accel.h" #include "migration/migration.h" -//#define DEBUG_XEN - -#ifdef DEBUG_XEN -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#ifndef DEBUG_XEN +#define DEBUG_XEN 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_XEN) { \ + fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \ + } \ +} while (0); static int store_dev_info(int domid, Chardev *cs, const char *string) { -- 2.8.0.rc3