mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 19:16:49 +08:00
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
This commit is contained in:
committed by
Joost VandeVondele
parent
e594aa7429
commit
952740b36c
@@ -837,12 +837,15 @@ ifneq ($(SUPPORTED_ARCH), true)
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: help build profile-build strip install clean net objclean profileclean \
|
||||
config-sanity \
|
||||
.PHONY: help analyze build profile-build strip install clean net \
|
||||
objclean profileclean config-sanity \
|
||||
icx-profile-use icx-profile-make \
|
||||
gcc-profile-use gcc-profile-make \
|
||||
clang-profile-use clang-profile-make FORCE
|
||||
|
||||
analyze: net config-sanity objclean
|
||||
$(MAKE) -k ARCH=$(ARCH) COMP=$(COMP) $(OBJS)
|
||||
|
||||
build: net config-sanity
|
||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
namespace Stockfish {
|
||||
|
||||
class Position;
|
||||
enum Value : int;
|
||||
|
||||
namespace Eval {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef MOVEGEN_H_INCLUDED
|
||||
#define MOVEGEN_H_INCLUDED
|
||||
|
||||
#include <algorithm>
|
||||
#include <algorithm> // IWYU pragma: keep
|
||||
#include <cstddef>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
Reference in New Issue
Block a user