From patchwork Wed Feb 10 19:38:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 8274301 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF30ABEEE5 for ; Wed, 10 Feb 2016 19:43:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C202203A4 for ; Wed, 10 Feb 2016 19:43:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E6D1201EF for ; Wed, 10 Feb 2016 19:43:44 +0000 (UTC) Received: from localhost ([::1]:42488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTafv-0000fR-WB for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Feb 2016 14:43:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaao-0008Dy-Qe for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTaaj-0003Av-4r for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaai-0003AF-UV for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:21 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 91467263C; Wed, 10 Feb 2016 19:38:20 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-56-231.rdu2.redhat.com [10.10.56.231]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1AJc9AF016300; Wed, 10 Feb 2016 14:38:19 -0500 From: John Snow To: qemu-devel@nongnu.org Date: Wed, 10 Feb 2016 14:38:05 -0500 Message-Id: <1455133089-31903-9-git-send-email-jsnow@redhat.com> In-Reply-To: <1455133089-31903-1-git-send-email-jsnow@redhat.com> References: <1455133089-31903-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, jsnow@redhat.com Subject: [Qemu-devel] [PULL 07/11] fdc: always compile-check debug prints X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Coverity noticed that some variables are only used by debug prints, and called them unused. Always compile the print statements. While we're here, print to stderr as well. Bonus: Fix a debug printf I broke in f31937aa8 Signed-off-by: John Snow Reviewed-by: Eric Blake [Touched up commit message. --js] Message-id: 1454971529-14830-1-git-send-email-jsnow@redhat.com --- 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]);