From 16bf5c49fa8706613318ac17ea7b5682a6e2cf41 Mon Sep 17 00:00:00 2001 From: Jon Maloy Date: Thu, 19 Nov 2026 20:32:47 -0500 Subject: clang-tidy: Disable checks new in clang-tidy 23 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 Signed-off-by: Stefano Brivio --- .clang-tidy | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index ec570f2..6aceb44 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 -- cgit v1.2.3