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(a)gmail.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.19.2