From patchwork Sat Apr 1 13:56:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9657989 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 2451F60349 for ; Sat, 1 Apr 2017 13:57:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B4CB1FF8E for ; Sat, 1 Apr 2017 13:57:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F89C205F7; Sat, 1 Apr 2017 13:57:22 +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 A7F951FF8E for ; Sat, 1 Apr 2017 13:57:21 +0000 (UTC) Received: from localhost ([::1]:51426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJWq-0005b6-Rj for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 09:57:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJW5-0005ZR-FE for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:56:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJW4-00040B-4M for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:56:33 -0400 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:36533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJW3-000400-Ug for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:56:32 -0400 Received: by mail-oi0-x243.google.com with SMTP id b187so13213520oif.3 for ; Sat, 01 Apr 2017 06:56:31 -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=C7Ek5cbKdiN7T4lpIGVuFFhFZbLB20cXG4hCM2olwBY=; b=c7KvyQR8urxbhuOXiJ2kwx51PBttXivGXDmO7s+JDaz3ysc0hQsZzww9dMzpcpG9cp lCAhkzr5J8BTLmMpRYLqHgh6bai0xfuRTqq+n5WpQJYi93vu9p0gAWeTHziMHgSa+HAp Jx/cccpzjbVHPymdkRpRyfjyBP0OGwBr3s26ik/vUBcKC+E799WZVZ6FdPT2Hq1jeEbD YVwIlQDE8CqBCFn1dUriEyQboLooXpbId3QPoslp8sbUf72yk+GsNjNIoV+EIc4AgJvz ngWGlTvI2d2LdqFgRj1nvxL+MGDO2wBz0alKyToDZ9xpuI5ZzCwSVCzQvoXmddBXs3Bw jhCQ== 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=C7Ek5cbKdiN7T4lpIGVuFFhFZbLB20cXG4hCM2olwBY=; b=Hm8qdG5HeCKZlUl8UpPV+4YWyRwuyTR4ABUc9IMLEGzmsTvBYT045xcihvmQ859SdN SVdqAv/W3Oa9riDVkTWZTNRGJQLub1V46ZIfSmJ75AxrZx95JP0eLmPIcclOUX+Ll4Dw 7uPm80SYXyFC5/f5bjhTgY010bLU6DMLRmCsxvU9GbatRFW79shPfy/DZzt7ULT0IUOp 9Ct/gVA6/Hk6CF3oEqGy9FHN2dI2YvjUoZSfRNe/AqNTpaz4ifODOJZbFqPppe5dCuoT MC1aFkwTAK2yZJ5gOcr4ATPGBKk9rx7YPHbM0Nn51jdLtJWb/k19eqijQFUuyEZDfV9c KHrw== X-Gm-Message-State: AFeK/H01rQiqu8aEvieOM6pFzRDc1PDVwUXnfadpKXvyVqPUpSwOfPf/LZuNd0AEghkuME+0xW7l24x/t8zlWA== X-Received: by 10.202.237.65 with SMTP id l62mr4686321oih.38.1491054991026; Sat, 01 Apr 2017 06:56:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 06:56:30 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 16:56:30 +0300 Message-ID: To: qemu-devel@nongnu.org, rth@twiddle.net X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::243 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 21/43] s390: 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 cbc3425092b6ee94d6666365f8714a39af5a583a Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:33:01 +0300 Subject: [PATCH 21/43] s390: 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/s390x/s390-pci-bus.c | 18 +++++++++++------- hw/s390x/s390-pci-inst.c | 18 +++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 69b0291..6dd9bca 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -24,13 +24,17 @@ #include "qemu/error-report.h" /* #define DEBUG_S390PCI_BUS */ -#ifdef DEBUG_S390PCI_BUS -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif + +#ifndef DEBUG_S390PCI_BUS +#define DEBUG_S390PCI_BUS 0 +#endif + +#define DPRINTF(fmt, ...) \ + do { \ + if (DEBUG_S390PCI_BUS) { \ + fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); \ + } \ + } while (0) S390pciState *s390_get_phb(void) { diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index d2a8c0a..82b5617 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -21,13 +21,17 @@ #include "sysemu/hw_accel.h" /* #define DEBUG_S390PCI_INST */ -#ifdef DEBUG_S390PCI_INST -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif + +#ifndef DEBUG_S390PCI_INST +#define DEBUG_S390PCI_INST 0 +#endif + +#define DPRINTF(fmt, ...) \ + do { \ + if (DEBUG_S390PCI_INST) { \ + fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); \ + } \ + } while (0) static void s390_set_status_code(CPUS390XState *env, uint8_t r, uint64_t status_code)