From patchwork Thu Dec 12 06:22:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11287111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D9D4930 for ; Thu, 12 Dec 2019 06:22:45 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2DD920637 for ; Thu, 12 Dec 2019 06:22:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2DD920637 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 3568961742D4; Thu, 12 Dec 2019 06:22:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 3568961742D4 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 2B51D5BE80A05; Thu, 12 Dec 2019 06:22:44 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 6BD305B11ACE2; Thu, 12 Dec 2019 06:22:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id BBC975BE809FF for ; Thu, 12 Dec 2019 06:22:38 +0000 (UTC) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 4E977605D2E9 for ; Thu, 12 Dec 2019 06:22:38 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id k25so594267pgt.7 for ; Wed, 11 Dec 2019 22:22:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tJMzRmOv5GWAhPF7SoJYIpVfNIDa/BA5mzLOnk4JDhk=; b=Cibk2bf+uYwhk5NO3r5JOAfdchBFbufasR6Nu9BVbW/Xw8cFmRQ+tBEfxHQQkEy3hY l5hXEZay90uzhrl9NM8dIsId/LgoDk5BZBdBtnGFlWXav0KWllDTfBDAw5Z1rqZTSJPf FdlqtZJ9kS0wSZW1Uhhl83sFvE0C3fQlo4xD4PO4tlexEpMJX4F2uA9nSvnCcPm0G3Qp B0F02zoDhJw7zzRgVV/bWx4ChuZmQNe8q6qh9o9vmlqpVQLDu/S1iJnAV2im96VXGv9t nDp07j5oS8oEA+RABiQ67d0wtA3bmDncnZDigea+dXtEiT60AlnvZyuyfWteJkPDc4v0 g+qg== X-Gm-Message-State: APjAAAWWvCMV3JCNIf8WDWgrV4Svvm5RqBiqRIqCbtnYwLzhgZ7hKIMH L97dxxuwpmC/vm6tomhkyHDDkzcW6TY= X-Google-Smtp-Source: APXvYqw9Y4KrjD3z7UTq8XBL8zdvs3JrN4kV/Cwl90xMIbSrRtcLJMt4p4t4tDRG9SEyeCh2sipzVg== X-Received: by 2002:aa7:8e05:: with SMTP id c5mr8193252pfr.4.1576131757068; Wed, 11 Dec 2019 22:22:37 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z10sm4960630pgg.39.2019.12.11.22.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 22:22:36 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [libteam PATCH] teamd: fix build error in expansion of macro teamd_log_dbgx Date: Thu, 12 Dec 2019 14:22:21 +0800 Message-Id: <20191212062221.14632-1-liuhangbin@gmail.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Message-ID-Hash: PFUHS7YZW4TATVDIGDFUSBW23YGQ4REC X-Message-ID-Hash: PFUHS7YZW4TATVDIGDFUSBW23YGQ4REC X-MailFrom: liuhangbin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Hangbin Liu , Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: With gcc 8.3 I got the following build error: In file included from teamd_dbus.c:33: teamd_dbus.c: In function 'teamd_dbus_init': teamd.h:54:2: error: expected expression before 'if' if (val <= ctx->debug) \ ^~ teamd.h:57:37: note: in expansion of macro 'teamd_log_dbgx' #define teamd_log_dbg(ctx, args...) teamd_log_dbgx(ctx, 1, ##args) ^~~~~~~~~~~~~~ teamd_dbus.c:507:2: note: in expansion of macro 'teamd_log_dbg' teamd_log_dbg(ctx, "dbus: connected to %s with name %s", id, ^~~~~~~~~~~~~ Fix it by adding parentheses and braces around the content. Fixes: f32310b9a5cc ("libteam: wapper teamd_log_dbg with teamd_log_dbgx") Signed-off-by: Hangbin Liu --- teamd/teamd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/teamd/teamd.h b/teamd/teamd.h index 469b769..fb2872e 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h @@ -51,8 +51,7 @@ #define teamd_log_info(args...) daemon_log(LOG_INFO, ##args) #define teamd_log_dbgx(ctx, val, args...) \ - if (val <= ctx->debug) \ - daemon_log(LOG_DEBUG, ##args) + ({ if (val <= ctx->debug) daemon_log(LOG_DEBUG, ##args); }) #define teamd_log_dbg(ctx, args...) teamd_log_dbgx(ctx, 1, ##args)