From patchwork Sat Apr 1 14:09:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658041 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 64FA9602BC for ; Sat, 1 Apr 2017 14:11:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CFA5285D2 for ; Sat, 1 Apr 2017 14:11:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F85A28616; Sat, 1 Apr 2017 14:11:01 +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 E8DAF285D2 for ; Sat, 1 Apr 2017 14:11:00 +0000 (UTC) Received: from localhost ([::1]:51572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJk3-0007RL-GM for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:10:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJj7-0007PD-EG for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:10:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJj6-0003z4-Bl for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:10:01 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:34483) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJj6-0003yt-50 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:10:00 -0400 Received: by mail-oi0-x241.google.com with SMTP id t11so13257094oib.1 for ; Sat, 01 Apr 2017 07:10:00 -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=Fi/ZDNFvnC9yF1J9BtpVB/yfZrjF/MJsUzdVF1fIwFk=; b=Sxb11t1oRsY0dZ5t9WJg82oql0jdRu6SOSIZ9MzqOj7DceXBRsszHYrQAdkb3pKRFh MhjTnMycmsgVk9ywL4njq60L90dWGrd+vqwQlcX+ZhOetXvDLEnxJ5TqJYZnu7AYfKG7 R6D8tmYgihBGWgFIcIVWNovcg2FmUzkmlFqGQa3/rKGaCjwC6RBTaUowIbOu2v57m7wh 8W+lqH865JaVl3lILQjp8okciKApNxae0G1D/6OIVUrxYnxwtyOU2yUqKo/QIeB2eL/D Q/zk4RtdOhngCnWUXiL6UIPdB1xzigKSGcbul+AT42R2ADYcwVnq1ua7UlMumAb1/L1W GNKg== 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=Fi/ZDNFvnC9yF1J9BtpVB/yfZrjF/MJsUzdVF1fIwFk=; b=Fhdw2vBxfS7AMHR7s1c9bKTm5kEvImsnbAqgpu3YZpLlcgKFgAif5ZFZX/edICLym0 F9tswBKopX+njnh6n8pPaDs5UW1Z6Dy9IS/Y3vRHvFaQwuiFKuCGrjmUGuStFfXeVSOc gcRmzSMKTa54v6QHOFKj/AG4QryQSmTBhKgnvGWzvKjPo3axwyL/GWhXlzx+s4Y/JPrV FpJ/9U2L7MxZqfAJLzMBvbdGQsfEWY2duiefQyQFeYvpeI9RcmjsSAWncNluNOIF1ZJL 3QQud42zZosmu6s60UzaB0GxjfydzfFUoqRpPUY9WStFnTD0VN81K5pF3wWNcRjVnvTv ncOw== X-Gm-Message-State: AFeK/H34iY3pNC9yGwLpoNfr5NdMQ6AKp3IGzHP3RexN8gPJV35tZJ38TesgcyPa89ody4SDmDrwN1KR1xNIEQ== X-Received: by 10.157.43.182 with SMTP id u51mr5432388ota.5.1491055799516; Sat, 01 Apr 2017 07:09:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:09:59 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:09:59 +0300 Message-ID: To: qemu-devel@nongnu.org, crosthwaite.peter@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::241 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 43/43] ssi: 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 0bf08ebad3ccfe3e07920f53a304478e1e3b5813 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:44:25 +0300 Subject: [PATCH 43/43] ssi: 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/ssi/pl022.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) #define PL022_CR1_SSE 0x02 diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c index c136801..bf1cc3a 100644 --- a/hw/ssi/pl022.c +++ b/hw/ssi/pl022.c @@ -12,18 +12,22 @@ #include "hw/ssi/ssi.h" #include "qemu/log.h" -//#define DEBUG_PL022 1 - -#ifdef DEBUG_PL022 -#define DPRINTF(fmt, ...) \ -do { printf("pl022: " fmt , ## __VA_ARGS__); } while (0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) -#else -#define DPRINTF(fmt, ...) do {} while(0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__);} while (0) -#endif +#ifndef DEBUG_PL022 +#define DEBUG_PL022 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_PL022) { \ + fprintf(stderr, "pl022: " fmt , ## __VA_ARGS__); \ + } \ +} while (0); + +#define BADF(fmt, ...) do { \ + fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); \ + if (DEBUG_PL022) { \ + exit(1); \ + } \ +} while (0); #define PL022_CR1_LBM 0x01