This PR is the first step towards treating IWYU warnings as errors. It utilises CMake’s native support via the CMAKE_CXX_INCLUDE_WHAT_YOU_USE
) variable. While this approach introduces some duplication at present, it will ultimately enable us to consolidate how the IWYU tool is executed, allowing for a choice between using the iwyu_tool.py
script or CMake’s built-in functionality.
At this stage, only the headers for the bitcoin_crypto
target have been updated, and the CI will now treat any future IWYU warnings as errors:
0...
1Warning: include-what-you-use reported diagnostics:
2
3(/ci_container_base/src/crypto/chacha20.h has correct #includes/fwd-decls)
4
5/ci_container_base/src/crypto/chacha20.cpp should add these lines:
6#include <assert.h> // for assert
7
8/ci_container_base/src/crypto/chacha20.cpp should remove these lines:
9- #include <string.h> // lines 15-15
10
11The full include-list for /ci_container_base/src/crypto/chacha20.cpp:
12#include <crypto/chacha20.h>
13#include <assert.h> // for assert
14#include <crypto/common.h> // for WriteLE32, ReadLE32
15#include <span.h> // for Span, UCharCast
16#include <support/cleanse.h> // for memory_cleanse
17#include <algorithm> // for copy, min
18#include <bit> // for rotl
19---
20
21gmake[3]: *** [src/crypto/CMakeFiles/bitcoin_crypto.dir/build.make:90: src/crypto/CMakeFiles/bitcoin_crypto.dir/chacha20.cpp.o] Error 1
22gmake[3]: *** Waiting for unfinished jobs....
23gmake[2]: *** [CMakeFiles/Makefile2:1097: src/crypto/CMakeFiles/bitcoin_crypto.dir/all] Error 2
24gmake[1]: *** [CMakeFiles/Makefile2:1104: src/crypto/CMakeFiles/bitcoin_crypto.dir/rule] Error 2
25gmake: *** [Makefile:452: bitcoin_crypto] Error 2