From patchwork Sat Apr 1 14:08:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658039 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 65F63602BC for ; Sat, 1 Apr 2017 14:09:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53E5C285D2 for ; Sat, 1 Apr 2017 14:09:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48DA228616; Sat, 1 Apr 2017 14:09:54 +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 E1E81285D2 for ; Sat, 1 Apr 2017 14:09:53 +0000 (UTC) Received: from localhost ([::1]:51566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJiy-0006ZH-Vj for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:09:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJi0-0006XU-QV for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:08:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJhz-0003GA-JU for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:08:52 -0400 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]:36468) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJhz-0003Fr-Dp for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:08:51 -0400 Received: by mail-oi0-x242.google.com with SMTP id b187so13246568oif.3 for ; Sat, 01 Apr 2017 07:08:51 -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=y92yUhgmgwvPw824BRNOfgLpFk1LilRAVXRyxfYHTrs=; b=gOAQCrWst9+MVM2Yk/iwjNL/6TAD24biNFSSUAuCA9hCZtxdNNeQByWkHCAT5ydSNS st99ZPmc3G4WiSIuhvUiTuGjkiOSTfGKN2xMMf5kTzBESWXB3HYH7MgifIRq+bVf/j/m c6QWPlxGJRPu0UHlzVsXj3t3uUlTlScreyeQq9WDCt4VSnexCocB/7cokOlCEIN14fq1 MfaEJ2sOhh1SKRdzTe2NniCO/Xt/w6Qzivy7gy4pzAA5EXoM2+lLGqCCr4FR/grnu6nT rA3oJMaIS+VEbOHrQGOQKjCCW1h3SOSIE/vEFRcZ82tHe6bq/Qm1M+avmQwL43ZVV+ro ymEw== 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=y92yUhgmgwvPw824BRNOfgLpFk1LilRAVXRyxfYHTrs=; b=h9nFdmj74ANRIR42SBeOhTIctqvYeydoTAfIu+rXsWsBXSr+GzgoPhZsPy7+25yarH EoY7LAt/lSp1tUpz/mqacFDS5R8Ujfx9YrNdUkGmH0ETTja9aaAenNwhpaHzELD9oNI3 T71o6hQ3ohYmU9hW1LuP+RDiLyAnjN+RTRUPUqeWL6nB7YgEpq1x7R8RcJYtJA1kWfbu T2STUhBUPuVXGKvZTv7XEgHANd03l58cJJHPGOS+QJS6xmZVBnTbPG86gvgJNRb0SpGO DLJtf4AXsfEPhOgmHeTROt8Dk22s7iwa0ZPdq7nURpvzyTKXIEyhFkmcUeSmD7a46up4 Q9/A== X-Gm-Message-State: AFeK/H0g6Pz2u2MVHD02xAogbjq+VIV5ORlraeaREeHuj5xDR5G4mKTuCTkxY/AOUx0tj+aRw9RyU11FGsns4Q== X-Received: by 10.202.237.65 with SMTP id l62mr4715715oih.38.1491055730683; Sat, 01 Apr 2017 07:08:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:08:50 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:08:50 +0300 Message-ID: To: qemu-devel@nongnu.org, agraf@suse.de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::242 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 41/43] nvram: 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 f0ac5a35af1c521bb8f87720ec7f82a9452e38a4 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:43:45 +0300 Subject: [PATCH 41/43] nvram: 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/nvram/mac_nvram.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index aef80e6..e152203 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -32,12 +32,16 @@ /* debug NVR */ //#define DEBUG_NVR -#ifdef DEBUG_NVR -#define NVR_DPRINTF(fmt, ...) \ - do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0) -#else -#define NVR_DPRINTF(fmt, ...) -#endif +#ifndef DEBUG_NVR +#define DEBUG_NVR 0 +#endif + +#define NVR_DPRINTF(fmt, ...) \ + do { \ + if (DEBUG_NVR) { \ + fprintf(stderr, "NVR: " fmt, ## __VA_ARGS__); \ + } \ + } while (0) #define DEF_SYSTEM_SIZE 0xc10