-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. No functional changea
- Loading branch information
1 parent
016ad97
commit 3ddb27a
Showing
4 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
# Mappings for libcxx's internal headers | ||
{ include: [ "<__fwd/fstream.h>", private, "<iosfwd>", public ] }, | ||
{ include: [ "<__fwd/ios.h>", private, "<iosfwd>", public ] }, | ||
{ include: [ "<__fwd/istream.h>", private, "<iosfwd>", public ] }, | ||
{ include: [ "<__fwd/ostream.h>", private, "<iosfwd>", public ] }, | ||
{ include: [ "<__fwd/sstream.h>", private, "<iosfwd>", public ] }, | ||
{ include: [ "<__fwd/streambuf.h>", private, "<iosfwd>", public ] }, | ||
{ include: [ "<__fwd/string_view.h>", private, "<string_view>", public ] }, | ||
|
||
# Mappings for includes between public headers | ||
{ include: [ "<ios>", public, "<iostream>", public ] }, | ||
{ include: [ "<streambuf>", public, "<iostream>", public ] }, | ||
{ include: [ "<istream>", public, "<iostream>", public ] }, | ||
{ include: [ "<ostream>", public, "<iostream>", public ] }, | ||
{ include: [ "<iosfwd>", public, "<iostream>", public ] }, | ||
|
||
# Missing mappings in include-what-you-use's libcxx.imp | ||
{ include: ["@<__condition_variable/.*>", private, "<condition_variable>", public ] }, | ||
{ include: ["@<__mutex/.*>", private, "<mutex>", public ] }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters