From patchwork Sat Apr 1 14:09:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42CC1602BC for ; Sat, 1 Apr 2017 14:12:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B3CB282ED for ; Sat, 1 Apr 2017 14:12:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EBAC28613; Sat, 1 Apr 2017 14:12:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id BF99F282ED for ; Sat, 1 Apr 2017 14:12:27 +0000 (UTC) Received: from localhost ([::1]:51590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJlS-0000P1-Rj for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:12:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJiX-0006ur-Am for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:09:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJiW-0003jc-5Q for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:09:25 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:34851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJiV-0003j6-Vf for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:09:24 -0400 Received: by mail-oi0-x241.google.com with SMTP id d2so5907363oig.2 for ; Sat, 01 Apr 2017 07:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=gqDhQ7oJYvL1j9n9R/5YsOJBxa03H7fEWVVGJ7V7yco=; b=kxQjd+q5uqEPvcR6xOpGx/St2AFp/9BAnjEZG5T4eySs/6Sfil8/JocW9ALuvJKFv9 9A8JGD3hYjlv5SowUCqy/FRlChJ7UBadXic1PlpWaN/zS09O/ukBX4qdfl2KlVyFb9Gh C3B0mAw5TlzHP1o5S+OB2OGJXoPfCIaWyZ4wNnBmxdqthVOBc/vmMZgX6+sfYsJmOZ68 ObuQXvdB5L79tPatftMjby1vRh4cA2+BinUEmm4MxgQJBSE4DA/QHtuFmfWiCC30JEG0 X6snnXV0NCuvECm7IOvkGz06c04YBv1whBVIGIJ/DLagzF1AxiTEFTyBwG4wNvQToMIB 44/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=gqDhQ7oJYvL1j9n9R/5YsOJBxa03H7fEWVVGJ7V7yco=; b=qd5FfqD0qMed8gF1HQch7xvjqTaz8ZPjvMtVOYTMonP3pY6uBba9No3KtxEeKp8gfx J7lcA0BCNlTnXwMw2a7aOp3gChqNdyYFj/ebS/zAlm1dJa2MWyOuS2YizzvMA25PHbw7 JaYpujcSF3N1+2S4dhlyV2xWPQ8Eh6zCriZVVNJudjCTc9j12FiUgpREMgBUxLUmUIYX Ym1KVAdgqLaNiSsD/giF2keBhDaymdqwCyOckIQ3oL9akcYyhn4uUK8cUg4lbng5znDd yr5WH846aF2wsqSV07Fx20uZYoU7ByclgR905dtsEqP2VAQWb51gmSYF7bIM7rE3Jq1W uxuw== X-Gm-Message-State: AFeK/H1I6R4h8Vc/lKvSj0hkgMM/UuXuC/Q83t8HfI7pIQGtQUSIL24GXZArxtRhWQVD3SKG1HLA8PG8uLFhMg== X-Received: by 10.202.229.11 with SMTP id c11mr4482289oih.72.1491055763174; Sat, 01 Apr 2017 07:09:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:09:22 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:09:22 +0300 Message-ID: To: qemu-devel@nongnu.org, agraf@suse.de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::241 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 42/43] pci-bridge: made printf always compile in debug output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-Virus-Scanned: ClamAV using ClamSMTP From bd32eaf17d401067d46891facfa37fe2a315cd2a Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:44:02 +0300 Subject: [PATCH 42/43] pci-bridge: 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 --- hw/pci-bridge/dec.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c index 840c961..84149da 100644 --- a/hw/pci-bridge/dec.c +++ b/hw/pci-bridge/dec.c @@ -32,14 +32,16 @@ #include "hw/pci/pci_bus.h" /* debug DEC */ -//#define DEBUG_DEC - -#ifdef DEBUG_DEC -#define DEC_DPRINTF(fmt, ...) \ - do { printf("DEC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DEC_DPRINTF(fmt, ...) -#endif + +#ifndef DEBUG_DEC +#define DEBUG_DEC 0 +#endif + +#define DEC_DPRINTF(fmt, ...) do { \ + if (DEBUG_DEC) { \ + fprintf(stderr, "DEC: " fmt , ## __VA_ARGS__); \ + } \ +} while (0); #define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154)