From patchwork Sat Apr 1 13:59:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9657999 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 6A2F260349 for ; Sat, 1 Apr 2017 14:00:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62507285C2 for ; Sat, 1 Apr 2017 14:00:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 560CC28610; Sat, 1 Apr 2017 14:00:30 +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 E35BC285C2 for ; Sat, 1 Apr 2017 14:00:29 +0000 (UTC) Received: from localhost ([::1]:51435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJZr-0007q5-Mx for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:00:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJZ5-0007op-Uj for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJZ4-0005HR-WB for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:59:40 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:36732) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJZ4-0005Gq-Qv for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:59:38 -0400 Received: by mail-oi0-x244.google.com with SMTP id b187so13221229oif.3 for ; Sat, 01 Apr 2017 06:59:38 -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=eynD3QI0D4VUt7o8rMptt4KNhjCrq5sEWoqWdQrm7Ak=; b=THLFWDwp0mgsw3nz0AW7bFCi9HTRfuXIoiv+8sR9hFmkPQEMG1+gLXKaLREjoKcfTe +O/gKqWNlkrJ3fbc9jKODHnHbC94YuRIUny+84PtUV7k5UvpzSiYy9CSdMKDro+SBwzS qv/8xVffzmTF5iN+202yUKhBbSCEduwqjx6ADeXzI5h6G9+RgnEKBWs8VpPGx2fVmI/s X9LAr52P7XXHdKD9IYcJIKvugVYS/Bd6rZ6CTssScP09fvJlsEJBszRjUViXoasBZMRr EUKjy+4qrYTC9PN145415YeLjExBwt18rtL7wNgY9wvSgkUikV8/wMQ2pY6NbKANoeMk l/ow== 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=eynD3QI0D4VUt7o8rMptt4KNhjCrq5sEWoqWdQrm7Ak=; b=KIM65GSlpsC15xsGBFhxZfL5h+JzSmRyTA+ds7g9QBf9YtEKzD6YbH+o0M26MMNbzl xotwvKbqRfphhOPmlcqDqYLvKkzjNWkkAbWLlRENHUUOK/72NGfXXgNW0U79yJvPK4jn Ijh94aGgQA580al7AvBvtOeVxNhhq3gnkbe7jTajwfgj1/ixVVN+Ar79sQelygZPAhia qiGYt92uN1yV/MwrF9CJ4ogZA6H9HAH4F2In50v+tq/DhQD3TpkIAvhROk/VdArnCvIk W/z+f6BS3B0UnVtbqF8PkNjHATAqEyea7UEfo3DVNO5yGl/TVKzXjjFJHmBNYR0AWJ9m LkFg== X-Gm-Message-State: AFeK/H1IfEowGBHddu1dtBw7nQ0AGY2OXDq5zjomeqHHt7kUIBNsXah/A0nqtLz4IRL6dOxyS0MFA7/S7cu0rQ== X-Received: by 10.202.237.65 with SMTP id l62mr4690681oih.38.1491055177935; Sat, 01 Apr 2017 06:59:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 06:59:37 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 16:59:37 +0300 Message-ID: To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::244 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 25/43] kvm-all: 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 f818d3ef7db8cc5b99656fd1059c0d7d07dea571 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:35:36 +0300 Subject: [PATCH 25/43] kvm-all: 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 --- kvm-all.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 90b8573..47940b5 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -50,16 +50,16 @@ */ #define PAGE_SIZE getpagesize() -//#define DEBUG_KVM - -#ifdef DEBUG_KVM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) +#ifndef DEBUG_KVM +#define DEBUG_KVM 0 #endif +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_KVM) { \ + fprintf(stderr, fmt, ## __VA_ARGS__); \ + } \ +} while (0); + #define KVM_MSI_HASHTAB_SIZE 256 struct KVMParkedVcpu {