aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-05-11 20:03:18 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-05-12 00:04:03 +0200
commita82a2173d4ea41fe4e97d9451f8ed1626b00d612 (patch)
tree987d0986c86e6b2b2c2fbf895db73f01160bf19f
parentdb02221ceee1ec01d74ed15d5d5e2d8997c54f51 (diff)
downloadpasst-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.tar
passt-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.tar.gz
passt-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.tar.bz2
passt-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.tar.lz
passt-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.tar.xz
passt-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.tar.zst
passt-a82a2173d4ea41fe4e97d9451f8ed1626b00d612.zip
clang-tidy: Squash inconsistent brace warnings in foreach macros
clang-tidy, at least as of 22.1.4 complains about if/else statements with inconsistent braces. We generally do want consistend bracing per our coding style. However, some of our foreach macros generate inconsistent bracing in a way that can't really be avoided. Add suppressions to stop clang-tidy complaining about these. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--flow.c2
-rw-r--r--flow_table.h8
-rw-r--r--netlink.c1
3 files changed, 9 insertions, 2 deletions
diff --git a/flow.c b/flow.c
index 91f2b81..565ed2b 100644
--- a/flow.c
+++ b/flow.c
@@ -67,9 +67,11 @@ static_assert(ARRAY_SIZE(flow_epoll) == FLOW_NUM_TYPES,
#define foreach_established_tcp_flow(flow) \
flow_foreach_of_type((flow), FLOW_TCP) \
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
if (!tcp_flow_is_established(&(flow)->tcp)) \
/* NOLINTNEXTLINE(bugprone-branch-clone) */ \
continue; \
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
else
/* Global Flow Table */
diff --git a/flow_table.h b/flow_table.h
index 7694e72..e4ff6f7 100644
--- a/flow_table.h
+++ b/flow_table.h
@@ -67,8 +67,10 @@ extern union flow flowtab[];
*/
#define flow_foreach(flow) \
flow_foreach_slot((flow)) \
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
if ((flow)->f.state == FLOW_STATE_FREE) \
(flow) += (flow)->free.n - 1; \
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
else if ((flow)->f.state != FLOW_STATE_ACTIVE) { \
flow_err((flow), "Bad flow state during traversal"); \
continue; \
@@ -81,10 +83,12 @@ extern union flow flowtab[];
*/
#define flow_foreach_of_type(flow, type_) \
flow_foreach((flow)) \
- if ((flow)->f.type != (type_)) \
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
+ if ((flow)->f.type != (type_)) \
/* NOLINTNEXTLINE(bugprone-branch-clone) */ \
continue; \
- else
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
+ else \
/** flow_idx() - Index of flow from common structure
diff --git a/netlink.c b/netlink.c
index 9076462..c3c830e 100644
--- a/netlink.c
+++ b/netlink.c
@@ -224,6 +224,7 @@ static struct nlmsghdr *nl_next(int s, char *buf, struct nlmsghdr *nh, ssize_t *
nl_foreach((nh), (status), (s), (buf), (seq)) \
if ((nh)->nlmsg_type != (type)) { \
warn("netlink: Unexpected message type"); \
+ /* NOLINTNEXTLINE(readability-inconsistent-ifelse-braces) */\
} else
/**