From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Marc=20Mar=C3=AD?= Subject: [PATCH v2 02/16] s390: Convert conditional compilation of debug printfs to regular ifs Date: Tue, 13 May 2014 09:02:38 +0200 Message-ID: <1399964572-5376-3-git-send-email-marc.mari.barcelo@gmail.com> References: <1399964572-5376-1-git-send-email-marc.mari.barcelo@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Hajnoczi , =?UTF-8?q?Marc=20Mar=C3=AD?= , kvm@vger.kernel.org (open list:Overall) To: qemu-devel@nongnu.org Return-path: Received: from mail-wi0-f181.google.com ([209.85.212.181]:49231 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758590AbaEMHE1 (ORCPT ); Tue, 13 May 2014 03:04:27 -0400 Received: by mail-wi0-f181.google.com with SMTP id n15so55439wiw.8 for ; Tue, 13 May 2014 00:04:26 -0700 (PDT) In-Reply-To: <1399964572-5376-1-git-send-email-marc.mari.barcelo@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Modify debug macros to have the same format through the codebase and us= e regular ifs instead of ifdef. As the debug printf is always put in code, some casting had to be added= to avoid warnings treated as errors at compile time. Signed-off-by: Marc Mar=C3=AD --- hw/s390x/s390-virtio-bus.c | 8 ++++---- hw/s390x/s390-virtio.c | 8 ++++---- target-s390x/helper.c | 22 ++++++++++++++-------- target-s390x/kvm.c | 8 ++++---- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 9c71afa..c3a6302 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -38,13 +38,13 @@ /* #define DEBUG_S390 */ =20 #ifdef DEBUG_S390 -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ - do { } while (0) +#define DEBUG_S390_ENABLED 0 #endif =20 +#define DPRINTF(fmt, ...) QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virti= o bus", fmt, ## __VA_ARGS__) + #define VIRTIO_EXT_CODE 0x2603 =20 static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size, diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index aef2003..133c320 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -42,13 +42,13 @@ //#define DEBUG_S390 =20 #ifdef DEBUG_S390 -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ - do { } while (0) +#define DEBUG_S390_ENABLED 0 #endif =20 +#define DPRINTF(fmt, ...) QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virti= o", fmt, ## __VA_ARGS__) + #define MAX_BLK_DEVS 10 #define ZIPL_FILENAME "s390-zipl.rom" =20 diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 7c76fc1..c5bfa7e 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -30,19 +30,25 @@ //#define DEBUG_S390_STDOUT =20 #ifdef DEBUG_S390 -#ifdef DEBUG_S390_STDOUT -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); \ - qemu_log(fmt, ##__VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ - do { qemu_log(fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 0 #endif + +#ifdef DEBUG_S390_STDOUT +#define DEBUG_S390_STDOUT_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ - do { } while (0) +#define DEBUG_S390_STDOUT_ENABLED 0 #endif =20 +#define DPRINTF(fmt, ...) \ + do { \ + if(DEBUG_S390_ENABLED) { \ + qemu_log(fmt, ##__VA_ARGS__); \ + QEMU_DPRINTF(DEBUG_S390_STDOUT_ENABLED, "s390x helper", fm= t, ## __VA_ARGS__); \ + } \ + } while (0) + #ifdef DEBUG_S390_PTE #define PTE_DPRINTF DPRINTF #else diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index b7b0edc..5aad3c9 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -41,13 +41,13 @@ /* #define DEBUG_KVM */ =20 #ifdef DEBUG_KVM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_KVM_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ - do { } while (0) +#define DEBUG_KVM_ENABLED 0 #endif =20 +#define DPRINTF(fmt, ...) QEMU_DPRINTF(DEBUG_KVM_ENABLED, "s390 kvm", = fmt, ## __VA_ARGS__) + #define IPA0_DIAG 0x8300 #define IPA0_SIGP 0xae00 #define IPA0_B2 0xb200 --=20 1.7.10.4