[PATCH 0/3] Fix 'make clang-tidy' with clang-tidy 23
Fedora 45 ships clang-tidy 23.1.5, which breaks 'make clang-tidy' for three reasons: clang-tidy 23 dropped the hicpp module, so our existing exclusion for hicpp-signed-bitwise no longer applies to the check, now called bugprone-signed-bitwise; it adds a few new checks that don't fit our coding style; and an existing check now flags some redundant parentheses in passt-repair. Patches 1 and 2 adjust .clang-tidy, patch 3 fixes passt-repair.c. With these, 'make clang-tidy' passes again for passt, passt-repair and pesto, and nothing changes for older clang-tidy versions. Jon Maloy (3): clang-tidy: Also disable bugprone-signed-bitwise clang-tidy: Disable checks new in clang-tidy 23 passt-repair: Drop redundant parentheses around stat() calls .clang-tidy | 18 ++++++++++++++++-- passt-repair.c | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) -- 2.56.1
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
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
participants (1)
-
Jon Maloy