libteam/SOURCES/libteam-teamd-fix-build-error-in-expansion-of-macro-teamd_lo.patch

50 lines
1.8 KiB
Diff
Raw Normal View History

2020-06-09 19:48:55 +00:00
From 575edc0dbc7ae3dfa34e30c1496c3504eacbf56e Mon Sep 17 00:00:00 2001
Message-Id: <575edc0dbc7ae3dfa34e30c1496c3504eacbf56e.1588051704.git.lucien.xin@gmail.com>
In-Reply-To: <f32310b9a5cc0322d8f5c85d94e3866326bc68ce.1588051704.git.lucien.xin@gmail.com>
References: <f32310b9a5cc0322d8f5c85d94e3866326bc68ce.1588051704.git.lucien.xin@gmail.com>
From: Hangbin Liu <liuhangbin@gmail.com>
Date: Thu, 12 Dec 2019 14:22:21 +0800
Subject: [PATCH 3/4] teamd: fix build error in expansion of macro
teamd_log_dbgx
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 <liuhangbin@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
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)
--
2.1.0