mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 05:57:59 +01:00
Add lint check for bitcoin-config.h include IWYU pragma
Also, remove the no longer needed, remaining definitions and checks of HAVE_CONFIG_H.
This commit is contained in:
@@ -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
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user