From patchwork Sat Apr 1 14:07:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658035 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 903F2602BC for ; Sat, 1 Apr 2017 14:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F28285D2 for ; Sat, 1 Apr 2017 14:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D7DC28616; Sat, 1 Apr 2017 14:09:24 +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 231CB285D2 for ; Sat, 1 Apr 2017 14:09:24 +0000 (UTC) Received: from localhost ([::1]:51565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJiV-0006Hh-4c for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:09:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJgJ-0005Hh-7T for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:07:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJgI-0001gj-91 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:07:07 -0400 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]:36339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJgI-0001gV-37 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:07:06 -0400 Received: by mail-oi0-x242.google.com with SMTP id b187so13242090oif.3 for ; Sat, 01 Apr 2017 07:07:06 -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=HjLup75hq83xGe+aJUNw9E9Du4Ng9ewF4clTl8/yGAo=; b=BZVRJley5zC8yvzO7zD7rHfKWScUHaxbMt09XYhALMBiQ9TnflDH/gN9dT3i9i6uga 04K9ySmap9PnqGlqVJvJHUsKEaBsrPk1hVxGv5WeRFzmLlK8it1dC+XQzs2npWL13qu5 UDvmoMUwfTJ5Qs0w4rN/X7OI0t3CVIDp+6Yav3kd0WWD3OxrCR+XGOBG7AMW6SOMtYmk r68w/VFSpDMtkd7ZT/T2M54YYLzw+p8Y+BEN7z9Dhlm3DmUydJGndgTNGK8ON52BeNb/ 1XK+TTP8hzeeWmzg2/1tq3aDUBGyVdZCZnhyTo3HRB8eKMs09GzgeF6xJ8+1YKCyasxw rEUQ== 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=HjLup75hq83xGe+aJUNw9E9Du4Ng9ewF4clTl8/yGAo=; b=Yk5L+OJL4fft4FelMNJ7VBfl63b8CR7oKzxJoWSgGt7AvJUMqQs8iZZeaxtbvFz04B gxyS7qMIO7izyXuLSpCuVxE6o3C88k/agxWVufh3LEOFgVNLB1n7loTn2y9QTdPNvXRd 2HPwNG94AOm3cRuZfT/EZ5oJeDom3E8hQffZ8HYtdhdzlFpiO3pVzD573zGlDOPMursC hv1CepTqrHiCwNXazrCCwBc28by25mHhcrorR6ZLaqFXrNG4d4km6+8KjXloIydq9NRg 4s3AkR3xqAz7+kOu9ZiBRjJAbgqMMVgFqmiCmdAzLgm0Xartyea/C1D9LYHoIFKSkwsR DCOw== X-Gm-Message-State: AFeK/H3XcuFLkwPW40t26cmjdLWvonQFC5LH1WSEfZ8G2vbjHPGVBId340UpAtewjb1Ycod+AwbGfviFv5msMg== X-Received: by 10.157.15.157 with SMTP id d29mr5291677otd.48.1491055625276; Sat, 01 Apr 2017 07:07:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:07:04 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:07:04 +0300 Message-ID: To: qemu-devel@nongnu.org, kraxel@redhat.com 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 37/43] audio: 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 ef4e9e576ae80c227d06721284bd49b699e71c71 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:41:59 +0300 Subject: [PATCH 37/43] audio: 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/audio/lm4549.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index a46f230..962db8e 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -26,13 +26,17 @@ #define LM4549_DUMP_DAC_INPUT 1 #endif -#ifdef LM4549_DEBUG -#define DPRINTF(fmt, ...) \ -do { printf("lm4549: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) do {} while (0) +#ifndef LM4549_DEBUG +#define LM4549_DEBUG 0 #endif +#define DPRINTF(fmt, ...) \ + do { \ + if (LM4549_DEBUG) { \ + fprintf(stderr, "lm4549: " fmt, ## __VA_ARGS__); \ + } \ + } while (0) + #if defined(LM4549_DUMP_DAC_INPUT) static FILE *fp_dac_input; #endif @@ -159,7 +163,7 @@ uint32_t lm4549_read(lm4549_state *s, hwaddr offset) assert(offset < 128); value = regfile[offset]; - DPRINTF("read [0x%02x] = 0x%04x\n", offset, value); + DPRINTF("read [0x%02x] = 0x%04x\n", (int) offset, value); return value; } @@ -170,7 +174,7 @@ void lm4549_write(lm4549_state *s, uint16_t *regfile = s->regfile; assert(offset < 128); - DPRINTF("write [0x%02x] = 0x%04x\n", offset, value); + DPRINTF("write [0x%02x] = 0x%04x\n", (int) offset, value); switch (offset) { case LM4549_Reset: