From patchwork Sat Apr 1 14:08:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658033 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 1D515602BC for ; Sat, 1 Apr 2017 14:09:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 175B6285D2 for ; Sat, 1 Apr 2017 14:09:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BFE528616; Sat, 1 Apr 2017 14:09:11 +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 B734F285D2 for ; Sat, 1 Apr 2017 14:09:10 +0000 (UTC) Received: from localhost ([::1]:51562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJiH-0006Bv-N8 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:09:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJhS-00069x-Eo for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:08:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJhR-0002nq-Fe for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:08:18 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:34385) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJhR-0002nO-A3 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:08:17 -0400 Received: by mail-oi0-x244.google.com with SMTP id t11so13253113oib.1 for ; Sat, 01 Apr 2017 07:08:17 -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=9NLX3A2W9yqVZ0Kwz0vLR9lBAQB+m03+2BaNhQBiUe8=; b=OKt9D3JDnJXijcSBOiiLyl6IOouR0Vzg+zffqyv3jEKI+7qdyF+UXtynfRey0COMI4 pXmv//iFnech7qFvET+b0sDF7C4/wZSeyeiA05ME6h2cmTGzF+91nDi/ILrjq9tUupiE ZOISCt4i7FajMkUDQyI6Ib8HjqxGx1SAvy2LEgC2tOOdCv02hfkUwn7ImNuYGN2FssRQ ZM3jPL9aVRkLEi3cRiEBXIWl9WoBUhnJZ6t8GGSxQflOqSyp0md6sp2LIBjnWSdBx88d usysjilL18mf6q83cSS5jEvKHkEo5Kkv2V3dAqoCVTpMw9Oz5Z26a4ELR479+5y90Nh/ 4rmw== 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=9NLX3A2W9yqVZ0Kwz0vLR9lBAQB+m03+2BaNhQBiUe8=; b=pUfkbfYf+9Y275+6RJ5abKzTKUn3fEK8aufnHWOFso82UwgiaorwTyM5AklitY05DM Gtu5xbOZXI6qYJP2xRm4wHYrGgj201q8s/kaz7F312ei0c/RL/H36VWDR4h0077OnhvX Ghev2soQQ3nA9ODn0rmt7XnFikfIbUaszdIeXPVpQjB9aARvk5W7EfpFW5MxNbOLjnyo PgRt0kGd0A3T1YkgQ0r9NmbrCMiMtJ0nwypldgcuS/r/m41DiEXda0e7yyqxecSujx/h T1aGJSkG7FXJrwqIq6trHHWVtJSErWAsX2BiHWMwdov5feXw2efMsnk/VeGgeoU0M+sD u5Qw== X-Gm-Message-State: AFeK/H25YJwV4xyeWz2TCb8YSTTCnJwfH+ySbnZkaM1akAqdNvXD8d3u4C8T7BHeykzsZOQy60+Mc7v+9Ox6aQ== X-Received: by 10.157.6.7 with SMTP id 7mr5513495otn.246.1491055696692; Sat, 01 Apr 2017 07:08:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:08:16 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:08:16 +0300 Message-ID: To: qemu-devel@nongnu.org, aurelien@aurel32.net, yongbok.kim@imgtec.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 40/43] mips: 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 fafbd66ef7cd5e2295a5c14e24a6ec1520ca79f4 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:43:28 +0300 Subject: [PATCH 40/43] mips: 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/mips/gt64xxx_pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index 4811843..adb64ff 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -30,13 +30,16 @@ #include "hw/i386/pc.h" #include "exec/address-spaces.h" -//#define DEBUG -#ifdef DEBUG -#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__) -#else -#define DPRINTF(fmt, ...) -#endif +#ifndef DEBUG +#define DEBUG 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG) { \ + fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \ + } \ +} while (0); #define GT_REGS (0x1000 >> 2)