From patchwork Sat Apr 1 14:00:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658007 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 E37A160349 for ; Sat, 1 Apr 2017 14:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA2F3285C2 for ; Sat, 1 Apr 2017 14:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEEB028610; Sat, 1 Apr 2017 14:01:14 +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 7837F285C2 for ; Sat, 1 Apr 2017 14:01:14 +0000 (UTC) Received: from localhost ([::1]:51442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJab-0008Iv-JJ for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:01:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJZc-0008Gx-U1 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:00:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJZb-0005ei-IJ for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:00:12 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:34685) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJZb-0005dT-DB for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:00:11 -0400 Received: by mail-oi0-x241.google.com with SMTP id t11so13230512oib.1 for ; Sat, 01 Apr 2017 07:00:11 -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=5KfjF7XJQ5b2sLKEWLZ8Sg9dr1mlT7Mb0IL02c6yPm0=; b=qGLjgdaajb+Jxde7jwZBX/iUGRV/l90JZG3u8jPdvz50VwBbogslRwl6yBYjrEV4vN Rb7TxSgbvsKdNPIwnXgbp7NCv/bBEcHZ/ejRe2rCShAIpy7zaKRfOql/9rbSRqyd96r0 LqNa1HuudOodbS5SW42y6VEmlj26gYd5RtHiIJUfJ9TCGK495LjZmC4jkwyL2Q7YG7J0 tq5XGGygtyLeR9+uCucShnxGDgPRhKx97eLNci+MLpGp5vk7PJGLa4cKT1wtriGrGAbG sIoymHFSvTY+rWA8gYWsf1+PIuSebIp2T3GHEJT0BDYQQXHLSie2r0OnJiE/0jZBrSy0 E8KQ== 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=5KfjF7XJQ5b2sLKEWLZ8Sg9dr1mlT7Mb0IL02c6yPm0=; b=Y6u8UEtPb/9v3KlPzzGWB/oQrh4sJI9d591VL1z5rHfXiLLeZOYbEXdiaZlQaa2UWg EBWQjozzqlTAjxj2EP1euQInjycHd9LA0Aqtfu8W640R/k8Zb/sWTYdLRelTyvv1kLcN Wn5A3Pr87/2iTQqCDWS2ATJ5Z9ZSr5rXO94wN4FOJeoMw4zFs4BbALAG/rFtWHB8ciYf oWy8Slg01ULMYJZKg5iAMnpEVyIMN0STO6Ssc+9G9vVxZxwbnokFx//wr9+u1JTerF4O nFsIZPAeZFZ1XPNq1tkkrZQfo8b+bGrer5P1Edro5qqA+8bi+47Eo3L0Er9EqnTJaflR 8lpQ== X-Gm-Message-State: AFeK/H0/me0NYCY2k1r9T/eKqWIGesppJBvKPnJgQXwz8Y9vhdvY+4GRWhzn0JXl4bTJpRCuqLwQXtLXTZua/w== X-Received: by 10.202.207.19 with SMTP id f19mr4775489oig.115.1491055210559; Sat, 01 Apr 2017 07:00:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 07:00:10 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 17:00:10 +0300 Message-ID: To: qemu-devel@nongnu.org, gxt@mprc.pku.edu.cn 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 26/43] unicore32: 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 32ac7bdabbf1935a8a30f606aa3263461117e7d0 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:36:57 +0300 Subject: [PATCH 26/43] unicore32: 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 --- include/hw/unicore32/puv3.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/hw/unicore32/puv3.h b/include/hw/unicore32/puv3.h index 5a4839f..e9e3ae6 100644 --- a/include/hw/unicore32/puv3.h +++ b/include/hw/unicore32/puv3.h @@ -41,10 +41,15 @@ #define PUV3_IRQS_OST0 (26) /* All puv3_*.c use DPRINTF for debug. */ -#ifdef DEBUG_PUV3 -#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__) -#else -#define DPRINTF(fmt, ...) do {} while (0) -#endif + +#ifndef DEBUG_PUV3 +#define DEBUG_PUV3 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_PUV3) { \ + fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \ + } \ +} while (0); #endif /* QEMU_HW_PUV3_H */