From patchwork Sat Apr 1 14:01:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658011 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 BCC1960349 for ; Sat, 1 Apr 2017 14:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B598628613 for ; Sat, 1 Apr 2017 14:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA40E28617; Sat, 1 Apr 2017 14:03: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 4C1A828613 for ; Sat, 1 Apr 2017 14:03:28 +0000 (UTC) Received: from localhost ([::1]:51493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJcl-0001Zf-9N for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:03:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJak-0000o0-LA for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:01:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJaj-0006Mp-Ik for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:01:22 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:35880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJaj-0006M7-Cy for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:01:21 -0400 Received: by mail-oi0-x244.google.com with SMTP id b187so13225820oif.3 for ; Sat, 01 Apr 2017 07:01:21 -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=7CYFKWGJU0Tdfg+ic+MtSwiUr4DEShTqeSlCVk9Uzv0=; b=ggw+GzfYnWLyil2m0v3H0tpAAPuoAyQ5c0Nwr0/DljN+G4LNDaqehQaOn2LTKAsbli tigQVAZlVXWpgsg91etkPaOJffdxtG0hLJQBufqiW9eR1BjwAEEpmt9ts6nbla0mkkyI bM7eg+x6FpfGzJfj9bU9/PxYkiyV9MZNbk3JgpPfwrcwS6NchFa+rkOBEZgbVvFvT/du YnbFHBNNBkoHOiV3fOzeuXSrbE/YhgSQrIFTJW4e2ctnMUf4AYtF5d2icx5jDwM3iHak arIurdS0VhIpaCRk9IzK+1Qc9oS0M+dhbF3H4+N6acj6vAAHdyThlGZaKrUUuXzzPyJt U0Vw== 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=7CYFKWGJU0Tdfg+ic+MtSwiUr4DEShTqeSlCVk9Uzv0=; b=O2eHJAmGTQyXTKj3qChItWHiCMLD5TRkaXjzvBZa5SFdnNpKCv0AwhZXiuOk47itba HE6kCb9s83ep1QBxxtA+Ep1zp9MBPeRh4PFvR/Pw7ABRQqIuMfvWdwSMDWMoapN7E+Dh PxC7kQORaWr2iyk7pILgtJFlj23yqYXTSOtLJsyuLDSMyPHQXMWJGTPMyGPdsnhCuzrN GJrF6btJo8quzs9NlDUIPWPPX5TcGqRLFPWJ2F3OhGX1jKSh7keKpW/kRMMJaLQ7geDh o6DP65FuYcs4/SoEQ0JmZcwmrAZJF/vvRZZTpbKHuEcy/6kebhfIUH1p7drakOgC/ZUJ VseA== X-Gm-Message-State: AFeK/H3M9oPjtSwVMIkgQu45HWU8fYVb1V90e47dkGp9EfV8m07cVO3/imL1+3d5QX0sD73zg16WiE2FGldS9A== X-Received: by 10.202.76.213 with SMTP id z204mr4712325oia.14.1491055280615; Sat, 01 Apr 2017 07:01:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:01:20 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:01:20 +0300 Message-ID: To: qemu-devel@nongnu.org, mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::244 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 28/43] sparc64: 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 825d7eda5d2900ef7eda37eeebf2b50ea445d50b Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:38:23 +0300 Subject: [PATCH 28/43] sparc64: 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/sparc64/sparc64.c | 36 +++++++++++++++++++----------------- hw/sparc64/sun4u.c | 16 +++++++++------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 4e4fdab..2f1136f 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -29,23 +29,25 @@ #include "hw/sparc/sparc64.h" #include "qemu/timer.h" - -//#define DEBUG_IRQ -//#define DEBUG_TIMER - -#ifdef DEBUG_IRQ -#define CPUIRQ_DPRINTF(fmt, ...) \ - do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0) -#else -#define CPUIRQ_DPRINTF(fmt, ...) -#endif - -#ifdef DEBUG_TIMER -#define TIMER_DPRINTF(fmt, ...) \ - do { printf("TIMER: " fmt , ## __VA_ARGS__); } while (0) -#else -#define TIMER_DPRINTF(fmt, ...) -#endif +#ifndef DEBUG_IRQ +#define DEBUG_IRQ 0 +#endif + +#ifndef DEBUG_TIMER +#define DEBUG_TIMER 0 +#endif + +#define CPUIRQ_DPRINTF(fmt, ...) do { \ + if (DEBUG_IRQ) { \ + fprintf(stderr, "CPUIRQ: " fmt , ## __VA_ARGS__); \ + } \ +} while (0); + +#define TIMER_DPRINTF(fmt, ...) do { \ + if (DEBUG_TIMER) { \ + fprintf(stderr, "TIMER: " fmt , ## __VA_ARGS__); \ + } \ +} while (0); #define TICK_MAX 0x7fffffffffffffffULL diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index d347b66..c27b738 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -46,14 +46,16 @@ #include "elf.h" #include "qemu/cutils.h" -//#define DEBUG_EBUS -#ifdef DEBUG_EBUS -#define EBUS_DPRINTF(fmt, ...) \ - do { printf("EBUS: " fmt , ## __VA_ARGS__); } while (0) -#else -#define EBUS_DPRINTF(fmt, ...) -#endif +#ifndef DEBUG_EBUS +#define DEBUG_EBUS 0 +#endif + +#define EBUS_DPRINTF(fmt, ...) do { \ + if (DEBUG_EBUS) { \ + fprintf(stderr, "EBUS: " fmt , ## __VA_ARGS__); \ + } \ +} while (0); #define KERNEL_LOAD_ADDR 0x00404000 #define CMDLINE_ADDR 0x003ff000