On Tue, Feb 24, 2026 at 12:53 PM Stefano Brivio <sbrivio@redhat.com> wrote:

What I was suggesting was to sprinkle the code with beauties such as:

        /* NOLINTNEXTLINE(misc-include-cleaner) */

Unfortunatly it needs to go before the usage, not the include.

e.g.
/usr/local/google/home/pefoley/passt/util.c:122:21: error: no header providing "SOL_SOCKET" is directly included [misc-include-cleaner,-warnings-as-errors]
   15 |         if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &y, sizeof(y)))
      |                            ^
/usr/local/google/home/pefoley/passt/util.c:122:33: error: no header providing "SO_REUSEADDR" is directly included [misc-include-cleaner,-warnings-as-errors]
  122 |         if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &y, sizeof(y)))
      |                                        ^
/usr/local/google/home/pefoley/passt/util.c:143:34: error: no header providing "SO_BINDTODEVICE" is directly included [misc-include-cleaner,-warnings-as-errors]
  143 |                 if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
      |                                                ^
/usr/local/google/home/pefoley/passt/util.c:323:32: error: no header providing "SO_SNDBUF" is directly included [misc-include-cleaner,-warnings-as-errors]
  323 |         if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &v, sizeof(v)) ||
      |                                       ^
/usr/local/google/home/pefoley/passt/util.c:329:32: error: no header providing "SO_RCVBUF" is directly included [misc-include-cleaner,-warnings-as-errors]
  329 |         if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &v, sizeof(v)) ||
      |                                       ^
/usr/local/google/home/pefoley/passt/util.c:855:42: error: no header providing "iovec" is directly included [misc-include-cleaner,-warnings-as-errors]
   15 | int write_remainder(int fd, const struct iovec *iov, size_t iovcnt, size_t skip)
      |                                          ^
/usr/local/google/home/pefoley/passt/util.c:1070:15: error: no header providing "option" is directly included [misc-include-cleaner,-warnings-as-errors]
   15 |         const struct option optfd[] = { { "fd", required_argument, NULL, 'F' },
      |                      ^
/usr/local/google/home/pefoley/passt/util.c:1070:42: error: no header providing "required_argument" is directly included [misc-include-cleaner,-warnings-as-errors]
 1070 |         const struct option optfd[] = { { "fd", required_argument, NULL, 'F' },
      |                                                 ^
/usr/local/google/home/pefoley/passt/util.c:1077:10: error: no header providing "getopt_long" is directly included [misc-include-cleaner,-warnings-as-errors]
 1077 |                 name = getopt_long(argc, argv, "-:F:", optfd, NULL);
      |                        ^
/usr/local/google/home/pefoley/passt/util.c:1081:16: error: no header providing "optarg" is directly included [misc-include-cleaner,-warnings-as-errors]
   15 |                         fd = strtol(optarg, NULL, 0);
      |                                     ^
 

before each "offending" include line... assuming it works, and
assuming we need perhaps 20-30 of them. But if it's a lot more, then
that's not a reasonable option either.

I get "72 warnings treated as errors" when running clang-tidy with my current set of patches.
 

--
Stefano