]> git.sesse.net Git - stockfish/commit - src/movegen.h
Let CI check C++ includes
authorSebastian Buchwald <UniQP@web.de>
Mon, 11 Sep 2023 22:03:04 +0000 (00:03 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Fri, 22 Sep 2023 17:12:53 +0000 (19:12 +0200)
commit952740b36ca46961a64457767f58dfbe71ae1ead
tree54a374ceea24efb9a662f2522cd19fe9451e7eb2
parente594aa74290cf37881432f268befde9ad3f3c498
Let CI check C++ includes

The commit adds a CI workflow that uses the included-what-you-use (IWYU)
tool to check for missing or superfluous includes in .cpp files and
their corresponding .h files. This means that some .h files (especially
in the nnue folder) are not checked yet.

The CI setup looks like this:
- We build IWYU from source to include some yet unreleased fixes.
  This IWYU version targets LLVM 17. Thus, we get the latest release
  candidate of LLVM 17 from LLVM's nightly packages.
- The Makefile now has an analyze target that just build the object
  files (without linking)
- The CI uses the analyze target with the IWYU tool as compiler to
  analyze the compiled .cpp file and its corresponding .h file.
- If IWYU suggests a change the build fails (-Xiwyu --error).
- To avoid false positives we use LLVM's libc++ as standard library
- We have a custom mappings file that adds some mappings that are
  missing in IWYU's default mappings

We also had to add one IWYU pragma to prevent a false positive in
movegen.h.

https://github.com/official-stockfish/Stockfish/pull/4783

No functional change
.github/workflows/libcxx17.imp [new file with mode: 0644]
.github/workflows/stockfish.yml
.github/workflows/stockfish_analyzers.yml [new file with mode: 0644]
src/Makefile
src/evaluate.h
src/movegen.h