From patchwork Sat Apr 1 13:35:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9657903 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 BC60B602BC for ; Sat, 1 Apr 2017 13:36:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A96992856C for ; Sat, 1 Apr 2017 13:36:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BD552860F; Sat, 1 Apr 2017 13:36:44 +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 3D6072856C for ; Sat, 1 Apr 2017 13:36:44 +0000 (UTC) Received: from localhost ([::1]:51362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJCt-0003wm-DI for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 09:36:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJC5-0003vH-Qt for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:35:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJC4-0007nG-Po for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:35:53 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:35618) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJC4-0007mz-K8 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:35:52 -0400 Received: by mail-oi0-x241.google.com with SMTP id d2so5824630oig.2 for ; Sat, 01 Apr 2017 06:35:52 -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=03cBgtI+BREkR8gx8HgKmogMCV+BWk+MMFMLvYnsMkA=; b=SOMz8+/9b9FiGBq2HcXZiXHsITgddPMHldJFiuLwRMJMuk503Mgd3vXtjvAYQ6F7Z3 AKIQ68zaE9e4GlYLn1neLNlSCRP2SqglMEhssqsMkPGpdPTRvWkhjMM8FLTiSl8R+o2U 2Im2ScNFFWS20chwZniCoFYg/6cGdRqcyuVDSq/RIW2J5DdOlV2FDCmx4qANcMSQMwxU z8VYxb4kiTUicPGcQMp71c4cQrnHWN/Wrxgzhw1glkOtT+2l+yrDUxeIff7iiZQYCI8O 4TNP+a5o6zYNRHZNkf3SouMdcalKM5WGcSAaV+HgyC6ykhHGtfXuGrEpEXK7U7iGgONC NB9Q== 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=03cBgtI+BREkR8gx8HgKmogMCV+BWk+MMFMLvYnsMkA=; b=SEkugYYk+ckgyHNyZ2LLsWta1OLYlwjNlTRW06KxF5B/EP1vsZ9t0yexmrvGtJgKgR eOILnukWdklzSnF7KNVOkLYAUNtu9pKZsfZdQ/lgqjDI3Ema9vpcv21HrBTKz4qetB4i dnMGzJFKj8ctsg/NIf8BvKgIg0Qw3Di5x7KbKgVmC2XUFtRtxWDMS9DJuebyOLmxDD0c 9AOKDyAjIm0MxsguZlPpV8YGyvVLiAzGJhxSF7ZCgvU46pUZ/uyu+5gSKiqMM25aetrz GZjxlUNpPgbbcGv21vhWd5IQXj7FLE9OEA5FtTtTGMo3BkDtKkus2nahB88YSNwNmPM5 XR8Q== X-Gm-Message-State: AFeK/H2+2d3KIoQj3OMd8s12AvJuqFwUs1T0PqZbsWx/29dTbJAvp5eWi7KhWtyy9sDzCs6LAQzCu3U76OmzrA== X-Received: by 10.157.6.7 with SMTP id 7mr5443355otn.246.1491053751822; Sat, 01 Apr 2017 06:35:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 06:35:51 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 16:35:51 +0300 Message-ID: To: qemu-devel@nongnu.org, sstabellini@kernel.org, anthony.perard@citrix.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::241 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 05/43] xen-mapcache: made printf always compile in debug 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 0e4a8a20c9c05e547d42be1b9ef868d12e7b43a9 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 02:14:06 +0300 Subject: [PATCH 05/43] xen-mapcache: 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 --- xen-mapcache.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen-mapcache.c b/xen-mapcache.c index 1a96d2e..c2d1e6f 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -22,15 +22,15 @@ #include "trace-root.h" -//#define MAPCACHE_DEBUG - -#ifdef MAPCACHE_DEBUG -# define DPRINTF(fmt, ...) do { \ - fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \ -} while (0) -#else -# define DPRINTF(fmt, ...) do { } while (0) -#endif +#ifndef MAPCACHE_DEBUG +#define MAPCACHE_DEBUG 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (MAPCACHE_DEBUG) { \ + fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \ + } \ +} while (0); #if HOST_LONG_BITS == 32 # define MCACHE_BUCKET_SHIFT 16