From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSuYt-0007vT-IW for qemu-devel@nongnu.org; Mon, 08 Feb 2016 17:45:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSuYs-00054y-IY for qemu-devel@nongnu.org; Mon, 08 Feb 2016 17:45:39 -0500 From: John Snow Date: Mon, 8 Feb 2016 17:45:29 -0500 Message-Id: <1454971529-14830-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PATCH] fdc: always compile-check debug prints List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: John Snow , qemu-devel@nongnu.org Coverity noticed that some variables are only used by debug prints, and called them unused. Always compile the print statements. Bonus: Fix a printf I broke. Signed-off-by: John Snow --- hw/block/fdc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index a6f22ef..9838d21 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -41,14 +41,15 @@ /********************************************************/ /* debug Floppy devices */ -//#define DEBUG_FLOPPY -#ifdef DEBUG_FLOPPY +#define DEBUG_FLOPPY 0 + #define FLOPPY_DPRINTF(fmt, ...) \ - do { printf("FLOPPY: " fmt , ## __VA_ARGS__); } while (0) -#else -#define FLOPPY_DPRINTF(fmt, ...) -#endif + do { \ + if (DEBUG_FLOPPY) { \ + fprintf(stderr, "FLOPPY: " fmt , ## __VA_ARGS__); \ + } \ + } while (0) /********************************************************/ /* Floppy drive emulation */ @@ -353,7 +354,7 @@ static int pick_geometry(FDrive *drv) parse = &fd_formats[size_match]; FLOPPY_DPRINTF("User requested floppy drive type '%s', " "but inserted medium appears to be a " - "%d sector '%s' type\n", + "%"PRId64" sector '%s' type\n", FloppyDriveType_lookup[drv->drive], nb_sectors, FloppyDriveType_lookup[parse->drive]); -- 2.4.3