* [PATCH 1/3] clang-tidy: Also disable bugprone-signed-bitwise
2026-11-20 1:32 [PATCH 0/3] Fix 'make clang-tidy' with clang-tidy 23 Jon Maloy
@ 2026-11-20 1:32 ` Jon Maloy
2026-11-20 1:32 ` [PATCH 2/3] clang-tidy: Disable checks new in clang-tidy 23 Jon Maloy
2026-11-20 1:32 ` [PATCH 3/3] passt-repair: Drop redundant parentheses around stat() calls Jon Maloy
2 siblings, 0 replies; 4+ messages in thread
From: Jon Maloy @ 2026-11-20 1:32 UTC (permalink / raw)
To: sbrivio, david, jmaloy, passt-dev
The hicpp-signed-bitwise check is disabled in .clang-tidy, as we need
bitwise operations on signed values for syscalls, epoll_wait() flags,
etc.
clang-tidy 23 removed the hicpp module, moving its checks to other
modules, and hicpp-signed-bitwise became bugprone-signed-bitwise. The
existing exclusion therefore no longer applies, and as we enable all
checks and treat warnings as errors, 'make clang-tidy' fails with
clang-tidy 23.1.5, e.g.:
arp.c:139:37: error: use of a signed integer operand with a binary
bitwise operator [bugprone-signed-bitwise,-warnings-as-errors]
139 | a = fwd_get_addr(c, AF_INET, true, CONF_ADDR_ANY);
where CONF_ADDR_ANY is built from BIT(n), that is, (1UL << (n)), and
the shift count is a signed int.
Disable the check under its new name as well, keeping the old one for
older clang-tidy versions.
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
.clang-tidy | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.clang-tidy b/.clang-tidy
index 9ba43bf0..ec570f2d 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -26,8 +26,10 @@ Checks:
# TODO: this is Linux-only for the moment, nice to fix eventually
- "-llvmlibc-restrict-system-libc-headers"
- # Those are needed for syscalls, epoll_wait flags, etc.
+ # Those are needed for syscalls, epoll_wait flags, etc. Moved
+ # from hicpp to bugprone as clang-tidy 23 dropped the hicpp module
- "-hicpp-signed-bitwise"
+ - "-bugprone-signed-bitwise"
# Probably not doable to impement this without plain memcpy(), memset()
- "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling"
--
2.56.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/3] clang-tidy: Disable checks new in clang-tidy 23
2026-11-20 1:32 [PATCH 0/3] Fix 'make clang-tidy' with clang-tidy 23 Jon Maloy
2026-11-20 1:32 ` [PATCH 1/3] clang-tidy: Also disable bugprone-signed-bitwise Jon Maloy
@ 2026-11-20 1:32 ` Jon Maloy
2026-11-20 1:32 ` [PATCH 3/3] passt-repair: Drop redundant parentheses around stat() calls Jon Maloy
2 siblings, 0 replies; 4+ messages in thread
From: Jon Maloy @ 2026-11-20 1:32 UTC (permalink / raw)
To: sbrivio, david, jmaloy, passt-dev
clang-tidy 23 introduces three new checks, which make
'make clang-tidy' fail on code that's otherwise fine:
- readability-trailing-comma wants a trailing comma in every
multi-line initialiser list, and none in single-line ones. That's
not part of our coding style, and it reports about 30 sites
(dhcpv6.c, ndp.c, netlink.c, pcap.c, tap.c, ...)
- readability-redundant-nested-if wants nested if statements merged
into a single condition, also where the inner condition has side
effects, as in bind() or setsockopt() calls, or a dedicated comment
(util.c, tcp.c, ...). Merging those would hurt readability, much
like the braces-around-statements checks we already disable
- bugprone-assignment-in-selection-statement, which cert-exp45-c is
now an alias of, reports assignments in conditions (conf.c, flow.c,
udp.c), like bugprone-assignment-in-if-condition, which we already
disable for the same reasons
Disable these checks.
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
.clang-tidy | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/.clang-tidy b/.clang-tidy
index ec570f2d..6aceb44a 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -9,8 +9,11 @@ Checks:
- "-cppcoreguidelines-init-variables"
# Dubious value over the compiler's built-in warning. Would
- # increase verbosity.
+ # increase verbosity. Same for its broader variant, added in
+ # clang-tidy 23, also known as cert-exp45-c
- "-bugprone-assignment-in-if-condition"
+ - "-bugprone-assignment-in-selection-statement"
+ - "-cert-exp45-c"
# Debatable whether these improve readability, right now it would look
# like a mess
@@ -99,6 +102,15 @@ Checks:
# be treated directly as a bool.
- "-readability-implicit-bool-conversion"
+ # Wants trailing commas in multi-line initialiser lists, and none in
+ # single-line ones. Not part of our coding style, and enforcing it
+ # would mean churn all over the place for no practical benefit.
+ - "-readability-trailing-comma"
+
+ # Merging nested if statements would often hurt readability, e.g.
+ # where the inner condition has side effects or a separate comment.
+ - "-readability-redundant-nested-if"
+
WarningsAsErrors: "*"
HeaderFileExtensions:
- h
--
2.56.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/3] passt-repair: Drop redundant parentheses around stat() calls
2026-11-20 1:32 [PATCH 0/3] Fix 'make clang-tidy' with clang-tidy 23 Jon Maloy
2026-11-20 1:32 ` [PATCH 1/3] clang-tidy: Also disable bugprone-signed-bitwise Jon Maloy
2026-11-20 1:32 ` [PATCH 2/3] clang-tidy: Disable checks new in clang-tidy 23 Jon Maloy
@ 2026-11-20 1:32 ` Jon Maloy
2 siblings, 0 replies; 4+ messages in thread
From: Jon Maloy @ 2026-11-20 1:32 UTC (permalink / raw)
To: sbrivio, david, jmaloy, passt-dev
clang-tidy 23.1.5 reports:
passt-repair.c:122:6: error: redundant parentheses around expression
[readability-redundant-parentheses,-warnings-as-errors]
122 | if ((stat(a->sun_path, sb))) {
and the same for the stat() call in main(). There's no assignment in
those conditions, so the extra parentheses are pointless. Drop them.
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
passt-repair.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/passt-repair.c b/passt-repair.c
index 3958c3af..2a147432 100644
--- a/passt-repair.c
+++ b/passt-repair.c
@@ -119,7 +119,7 @@ static int wait_for_socket(struct sockaddr_un *a, const char *dir,
ret = snprintf(a->sun_path, sizeof(a->sun_path), "%s/%s",
dir, ev->name);
- if ((stat(a->sun_path, sb))) {
+ if (stat(a->sun_path, sb)) {
FPRINTF(stderr, "Can't stat() %s: %i\n", a->sun_path, errno);
_exit(1);
}
@@ -186,7 +186,7 @@ int main(int argc, char **argv)
_exit(1);
}
- if ((stat(argv[1], &sb))) {
+ if (stat(argv[1], &sb)) {
FPRINTF(stderr, "Can't stat() %s: %i\n", argv[1], errno);
_exit(1);
}
--
2.56.1
^ permalink raw reply [flat|nested] 4+ messages in thread