summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorEric Blake2018-02-13 21:26:56 +0100
committerKevin Wolf2018-03-02 18:39:07 +0100
commitb80666bf844bac5ae775cb67029a3cd67ad7c730 (patch)
tree7accab7ff680cc7c6413bdc690157ecb315a3ddb /block
parentsheepdog: Switch to .bdrv_co_block_status() (diff)
downloadqemu-b80666bf844bac5ae775cb67029a3cd67ad7c730.tar.gz
qemu-b80666bf844bac5ae775cb67029a3cd67ad7c730.tar.xz
qemu-b80666bf844bac5ae775cb67029a3cd67ad7c730.zip
vdi: Avoid bitrot of debugging code
Rework the debug define so that we always get -Wformat checking, even when debugging is disabled. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vdi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/block/vdi.c b/block/vdi.c
index fc1c614cb1..32b1763cde 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -87,12 +87,18 @@
#define DEFAULT_CLUSTER_SIZE (1 * MiB)
#if defined(CONFIG_VDI_DEBUG)
-#define logout(fmt, ...) \
- fprintf(stderr, "vdi\t%-24s" fmt, __func__, ##__VA_ARGS__)
+#define VDI_DEBUG 1
#else
-#define logout(fmt, ...) ((void)0)
+#define VDI_DEBUG 0
#endif
+#define logout(fmt, ...) \
+ do { \
+ if (VDI_DEBUG) { \
+ fprintf(stderr, "vdi\t%-24s" fmt, __func__, ##__VA_ARGS__); \
+ } \
+ } while (0)
+
/* Image signature. */
#define VDI_SIGNATURE 0xbeda107f