From: Laurent Vivier <lvivier@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>,
passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH 4/8] clang-tidy: Squash inconsistent brace warnings in foreach macros
Date: Mon, 11 May 2026 15:21:46 +0200 [thread overview]
Message-ID: <0cea9362-8f12-4e1c-87da-7f2368c4bcdc@redhat.com> (raw)
In-Reply-To: <20260511100322.1016757-5-david@gibson.dropbear.id.au>
On 5/11/26 12:03, David Gibson wrote:
> 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>
> ---
> flow.c | 2 ++
> flow_table.h | 8 ++++++--
> netlink.c | 1 +
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/flow.c b/flow.c
> index 91f2b81f..565ed2b2 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 7694e726..e4ff6f73 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 9076462b..c3c830e1 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
>
> /**
next prev parent reply other threads:[~2026-05-11 13:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 10:03 [PATCH 0/8] Fix assorted warnings David Gibson
2026-05-11 10:03 ` [PATCH 1/8] netlink: erromsg should be const in nl_status() David Gibson
2026-05-11 12:50 ` Laurent Vivier
2026-05-11 10:03 ` [PATCH 2/8] virtio: Reduce scope of variable David Gibson
2026-05-11 12:51 ` Laurent Vivier
2026-05-11 10:03 ` [PATCH 3/8] conf: Fix not-actually-const parameter to conf_runas() and conf_ugid() David Gibson
2026-05-11 13:00 ` Laurent Vivier
2026-05-11 10:03 ` [PATCH 4/8] clang-tidy: Squash inconsistent brace warnings in foreach macros David Gibson
2026-05-11 13:21 ` Laurent Vivier [this message]
2026-05-11 10:03 ` [PATCH 5/8] clang-tidy: Suppress sscanf() warning harder David Gibson
2026-05-11 13:23 ` Laurent Vivier
2026-05-11 10:03 ` [PATCH 6/8] packet, clang-tidy: Packet pool buffers are not NULL David Gibson
2026-05-11 13:27 ` Laurent Vivier
2026-05-11 10:03 ` [PATCH 7/8] treewide: Make some additional variables static David Gibson
2026-05-11 13:30 ` Laurent Vivier
2026-05-11 10:03 ` [PATCH 8/8] clang-tidy: Suppress some new unhelpful new warnings David Gibson
2026-05-11 13:32 ` Laurent Vivier
2026-05-12 5:45 ` [PATCH 0/8] Fix assorted warnings Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0cea9362-8f12-4e1c-87da-7f2368c4bcdc@redhat.com \
--to=lvivier@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).