On Tue, 24 Feb 2026 16:43:13 +1100
David Gibson
On Mon, Feb 23, 2026 at 01:08:07PM -0500, Peter Foley wrote:
On Mon, Feb 23, 2026 at 12:35 PM Stefano Brivio
wrote: By the way, we already run clang-tidy tests ('make clang-tidy') as part of our tests (test/build/static_checkers.sh).
Would it be just a matter of enabling the misc-include-cleaner in the list of tests we give clang-tidy from the Makefile:
https://clang.llvm.org/extra/clang-tidy/checks/misc/include-cleaner.html
? I haven't tried.
It appears so, a local change to pass -checks=misc-include-cleaner to clang-tidy resulted in a ton of errors like: /usr/local/google/home/pefoley/passt/vu_common.c:277:2: error: no header providing "iov_from_buf" is directly included [misc-include-cleaner,-warnings-as-errors] 277 | iov_from_buf(in_sg, elem_cnt, VNET_HLEN, buf, total); | ^ /usr/local/google/home/pefoley/passt/vu_common.c:301:15: error: no header providing "ETH_ZLEN" is directly included [misc-include-cleaner,-warnings-as-errors] 9 | if (l2len >= ETH_ZLEN) | ^ /usr/local/google/home/pefoley/passt/vu_common.c:304:2: error: no header providing "memset" is directly included [misc-include-cleaner,-warnings-as-errors] 9 | memset((char *)iov->iov_base + iov->iov_len, 0, ETH_ZLEN - l2len);
Unfortunately, I suspect this isn't going to work out. It may do some of the checks we want here, but unfortunately it makes some very silly warnings in relation to the standard library, which is why we disabled it in the first place. See commit 3be9e0010ea7329ae0f3707f67ac4cf0bac13d54
Ouch, right, I had forgotten about that.
I guess we should retry and see if the latest LLVM is better about this, though.
I guess: https://github.com/pefoley2/passt/commit/6ae0bcb2bbdc10384346dda547db60f80c8... makes that mostly pass with a recent LLVM version? If we need a dozen of suppressions (maybe even 20-30?) I would say it's sustainable, but more than that and it will start looking messy. -- Stefano