From patchwork Fri Jul 21 14:31:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 792153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xDYC15YzHz9sNx for ; Sat, 22 Jul 2017 00:32:45 +1000 (AEST) Received: from localhost ([::1]:43501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYYyx-00067S-8R for incoming@patchwork.ozlabs.org; Fri, 21 Jul 2017 10:32:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYYyF-00066M-8u for qemu-devel@nongnu.org; Fri, 21 Jul 2017 10:32:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYYyC-0001Zm-Tu for qemu-devel@nongnu.org; Fri, 21 Jul 2017 10:31:59 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:34750 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYYyC-0001W1-Gg for qemu-devel@nongnu.org; Fri, 21 Jul 2017 10:31:56 -0400 Received: from kvm.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v6LEVnh9023008; Fri, 21 Jul 2017 17:31:51 +0300 (MSK) From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 17:31:48 +0300 Message-Id: <20170721143149.43721-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170721143149.43721-1-vsementsov@virtuozzo.com> References: <20170721143149.43721-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 1/2] trace: do not calculate arguments for disabled trace-points 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: , Cc: den@openvz.org, vsementsov@virtuozzo.com, dgilbert@redhat.com, stefanha@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Do not calculate arguments if trace-point is disabled. For this: - move to macro do { ... } while (0) scheme - use additional macro-layer to handle calls of trace-points where a macro generates parameter list (like trace_e1000e_mac_set_permanent(MAC_ARG(macaddr))) This is needed to allow some additional logic in trace-point parameter calculation, which will not be executed if this trace-point is disabled. Signed-off-by: Vladimir Sementsov-Ogievskiy --- scripts/tracetool/format/h.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index aecf249d66..d0baccc453 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -73,12 +73,13 @@ def generate(events, backend, group): cond = "true" out('', - 'static inline void %(api)s(%(args)s)', - '{', - ' if (%(cond)s) {', - ' %(api_nocheck)s(%(names)s);', - ' }', - '}', + '#define %(api)s(...) _do_%(api)s(__VA_ARGS__)', + '#define _do_%(api)s(%(names)s) \\', + 'do { \\', + ' if (%(cond)s) { \\', + ' %(api_nocheck)s(%(names)s); \\', + ' } \\', + '} while (0)', api=e.api(), api_nocheck=e.api(e.QEMU_TRACE_NOCHECK), args=e.args,