From: Thomas Huth <thuth@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, Danil Antonov <g.danil.anto@gmail.com>,
agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH for-2.10 03/10] s390x/pci: make printf always compile in debug output
Date: Thu, 6 Apr 2017 14:15:45 +0200 [thread overview]
Message-ID: <865405dc-f785-c458-3de7-dfc49dfca15f@redhat.com> (raw)
In-Reply-To: <20170406111646.12624-4-cornelia.huck@de.ibm.com>
On 06.04.2017 13:16, Cornelia Huck wrote:
> From: Danil Antonov <g.danil.anto@gmail.com>
>
> 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 <g.danil.anto@gmail.com>
> Message-Id: <CA+KKJYBi31Bs7DtVdzZdwG2t+u5+FGiAhQpd3pqJzUX1O8Cprg@mail.gmail.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> ---
> hw/s390x/s390-pci-bus.c | 16 ++++++++++------
> hw/s390x/s390-pci-inst.c | 16 ++++++++++------
> 2 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 69b0291e8a..0f62363434 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -24,14 +24,18 @@
> #include "qemu/error-report.h"
>
> /* #define DEBUG_S390PCI_BUS */
This comment is now somewhat misleading. If you uncomment this "#define
DEBUG_S390PCI_BUS" (without adding a "1" at the end), you end up with
some empty "if ()" statements now, i.e. compilation failures. So I'd
like to suggest to simply remove the above line.
> -#ifdef DEBUG_S390PCI_BUS
> -#define DPRINTF(fmt, ...) \
> - do { fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); } while (0)
> -#else
> -#define DPRINTF(fmt, ...) \
> - do { } while (0)
> +
> +#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)
> {
> static S390pciState *phb;
> diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
> index d2a8c0a083..763eebd67f 100644
> --- a/hw/s390x/s390-pci-inst.c
> +++ b/hw/s390x/s390-pci-inst.c
> @@ -21,14 +21,18 @@
> #include "sysemu/hw_accel.h"
>
> /* #define DEBUG_S390PCI_INST */
dito
> -#ifdef DEBUG_S390PCI_INST
> -#define DPRINTF(fmt, ...) \
> - do { fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); } while (0)
> -#else
> -#define DPRINTF(fmt, ...) \
> - do { } while (0)
> +
> +#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)
> {
>
Thomas
next prev parent reply other threads:[~2017-04-06 12:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 11:16 [Qemu-devel] [PATCH for-2.10 00/10] s390x queue for 2.10 Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 01/10] s390x: introduce 2.10 compat machine Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 02/10] s390x/kvm: make printf always compile in debug output Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 03/10] s390x/pci: " Cornelia Huck
2017-04-06 12:15 ` Thomas Huth [this message]
2017-04-06 13:07 ` Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 04/10] s390x/css: introduce read-only property type for device ids Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 05/10] s390x/css: provide introspection for virtual subchannel and device busid Cornelia Huck
2017-04-06 12:19 ` Thomas Huth
2017-04-06 13:16 ` Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 06/10] s390x/css: consolidate the devno property for ccw devices Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 07/10] s390x: use enum for adapter type and standardize its naming Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 08/10] s390x: initialize flic before I/O subsystems Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 09/10] s390x/flic: cache flic in s390_get_flic Cornelia Huck
2017-04-06 11:16 ` [Qemu-devel] [PATCH for-2.10 10/10] s390x: register I/O adapters per ISC during init Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=865405dc-f785-c458-3de7-dfc49dfca15f@redhat.com \
--to=thuth@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=g.danil.anto@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).