From patchwork Sat Apr 1 13:34:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9657901 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 D56EC602BC for ; Sat, 1 Apr 2017 13:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C24D7285D2 for ; Sat, 1 Apr 2017 13:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6E982860F; Sat, 1 Apr 2017 13:35:16 +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 70C22285D2 for ; Sat, 1 Apr 2017 13:35:16 +0000 (UTC) Received: from localhost ([::1]:51349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJBT-0002wf-Ih for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 09:35:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJAa-0002vH-Fh for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:34:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJAZ-00074L-FL for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:34:20 -0400 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:36143) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJAZ-000745-AL for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:34:19 -0400 Received: by mail-oi0-x243.google.com with SMTP id b187so13162216oif.3 for ; Sat, 01 Apr 2017 06:34:19 -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=+eK4qS9xwGgcTXevb+r4tlC/FJaItrwo2PyNDecRtaw=; b=qNZppaFRpkWgLZjgPSVP2oImHJj/HidoIG3uoLi8wOkMRFAPQ2FycOaqYiocvWOWdw 6UOpxVvLl3Ar8r77SCSLJMzLZe1sP5Nsdz97CHIBdTS4mTUOljrXRR3YmcVX4h4cdnt2 7kr4Qy5ak6bX/tEi4PCO2IqXJJTktth8YFQ6c/5mzdPFKoBcx7SkOeGFitUBqLkyy7fg q3RrRbEVH/tdoYcbQbj8xAbCEDwEs/i9U6zS1Z34phPY4KH2WUl1+XXT7RB3WXekbY0o IeiwsxFKg1aMIUUNT5xG0w0EugoHHUG5DPj3+Truf+Jkr5Ewq41RtZPz8/V5DLwNNKC3 rtxQ== 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=+eK4qS9xwGgcTXevb+r4tlC/FJaItrwo2PyNDecRtaw=; b=h3v1uIRXU9o19gH1kilwb4zeSPAjdrAu+Rgoz3mAi7wFN+c6Bqw7vo8R80sf0IZ9A4 ApIJBUBFrylxZSe7oYiWMlyzednsahfqnW1hy0ixOejHO1xVVZ8yF8t21isIRlpktAm5 s2/TKyuCPz3iA683PBLlXYr165wh4HoywagQuabVU1wEulPaeMOBzipV5K8PB/evdaEJ 1iFiYWewynSqspKbSXOfA6gLAo0wgYukH9Za3abfWqzuIJSUgNQmLF+ph8aswwBwgOQR spo6W+V8cBGiI1XTtmi9Q11zTPtF2RNxwTMFwYsLnC4GO6H76rFLoTsbogZdVFi6myNe s2KA== X-Gm-Message-State: AFeK/H1Z/XQ3mfxCi6dYRNK6ALmLpL+aYALCTFt8fMzXOSGmVMQGX5qHpv5Ox5nepOZR7evrScJhNTHfUAFlWw== X-Received: by 10.202.207.19 with SMTP id f19mr4738215oig.115.1491053658687; Sat, 01 Apr 2017 06:34:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 06:34:18 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 16:34:18 +0300 Message-ID: To: qemu-devel@nongnu.org, sstabellini@kernel.org, anthony.perard@citrix.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::243 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 04/43] xen-hvm: 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 05d558842b0a10ee3f0606eb54068b6ba03906a3 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 02:13:13 +0300 Subject: [PATCH 04/43] xen-hvm: 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-hvm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen-hvm.c b/xen-hvm.c index 5043beb..abf0f72 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -29,15 +29,15 @@ #include #include -//#define DEBUG_XEN_HVM - -#ifdef DEBUG_XEN_HVM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#ifndef DEBUG_XEN_HVM +#define DEBUG_XEN_HVM 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_XEN_HVM) { \ + fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \ + } \ +} while (0); static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi; static MemoryRegion *framebuffer;