diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-02-26 14:25:51 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-05-01 08:33:43 +0200 |
commit | fa09451f8e6799682d7e7c863f25334fd1c7dce3 (patch) | |
tree | f822561f1da249e75892f02926fab1ea039a14b1 /test/lint/test_runner/src/main.rs | |
parent | dddd40ba8267dea11a3eb03d5cf8b51dbb99be5d (diff) |
Add lint check for bitcoin-config.h include IWYU pragma
Also, remove the no longer needed, remaining definitions and checks of
HAVE_CONFIG_H.
Diffstat (limited to 'test/lint/test_runner/src/main.rs')
-rw-r--r-- | test/lint/test_runner/src/main.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs index e22e047e4b..9795f9ca34 100644 --- a/test/lint/test_runner/src/main.rs +++ b/test/lint/test_runner/src/main.rs @@ -178,7 +178,6 @@ Please add any false positives, such as subtrees, or externally sourced files to fn lint_includes_build_config() -> LintResult { let config_path = "./src/config/bitcoin-config.h.in"; - let include_directive = "#include <config/bitcoin-config.h>"; if !Path::new(config_path).is_file() { assert!(Command::new("./autogen.sh") .status() @@ -235,7 +234,11 @@ fn lint_includes_build_config() -> LintResult { } else { "--files-with-matches" }, - include_directive, + if mode { + "^#include <config/bitcoin-config.h> // IWYU pragma: keep$" + } else { + "#include <config/bitcoin-config.h>" // Catch redundant includes with and without the IWYU pragma + }, "--", ]) .args(defines_files.lines()) @@ -256,6 +259,11 @@ even though bitcoin-config.h indicates that a faster feature is available and sh If you are unsure which symbol is used, you can find it with this command: git grep --perl-regexp '{}' -- file_name + +Make sure to include it with the IWYU pragma. Otherwise, IWYU may falsely instruct to remove the +include again. + +#include <config/bitcoin-config.h> // IWYU pragma: keep "#, defines_regex )); |