Skip to content

Commit 8efd03a

Browse files
committed
Merge bitcoin/bitcoin#29494: build: Assume HAVE_CONFIG_H, Add IWYU pragma keep to bitcoin-config.h includes
fa09451 Add lint check for bitcoin-config.h include IWYU pragma (MarcoFalke) dddd40b scripted-diff: Add IWYU pragma keep to bitcoin-config.h includes (MarcoFalke) Pull request description: The `bitcoin-config.h` includes have issues: * The header is incompatible with iwyu, because symbols may be defined or not defined. So the `IWYU pragma: keep` is needed to keep the include when a symbol is not defined on a platform. Compare the previous discussion in bitcoin/bitcoin#29408 (comment) * Guarding the includes by `HAVE_CONFIG_H` is verbose and brittle. Now that all build config dependencies have been removed from low level headers, the benefits are questionable, and the guard can be removed. The linter could also be tricked by guarding the include by `#if defined(HAVE_C0NFIG_H)` (`O` replaced by `0`). Compare the previous discussion in bitcoin/bitcoin#29404 (comment) . ACKs for top commit: achow101: ACK fa09451 TheCharlatan: ACK fa09451 hebasto: re-ACK fa09451, only rebased since my recent [review](bitcoin/bitcoin#29494 (review)) (`timedata.cpp` removed in bitcoin/bitcoin#29623). Tree-SHA512: 47cb973f7f24bc625acc4e78683371863675d186780236d55d886cf4130e05a78bb04f1d731aae7088313b8e963a9677cc77cf518187dbd99d776f6421ca9b52
2 parents ef09f53 + fa09451 commit 8efd03a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+91
-237
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
227227
BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes)
228228
BITCOIN_QT_PATH_PROGS([LCONVERT], [lconvert-qt5 lconvert5 lconvert], $qt_bin_path, yes)
229229
230-
MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)'
230+
MOC_DEFS='-I$(srcdir)'
231231
case $host in
232232
*darwin*)
233233
BITCOIN_QT_CHECK([

build_msvc/bitcoin-qt/bitcoin-qt.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</Link>
6363
<ResourceCompile>
6464
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
65-
<PreprocessorDefinitions>HAVE_CONFIG_H;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
65+
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
6666
</ResourceCompile>
6767
</ItemDefinitionGroup>
6868

@@ -75,7 +75,7 @@
7575
</Link>
7676
<ResourceCompile>
7777
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
78-
<PreprocessorDefinitions>HAVE_CONFIG_H;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
78+
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
7979
</ResourceCompile>
8080
</ItemDefinitionGroup>
8181

build_msvc/common.init.vcxproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<AdditionalOptions>/utf-8 /Zc:preprocessor /Zc:__cplusplus /std:c++20 %(AdditionalOptions)</AdditionalOptions>
9191
<DisableSpecificWarnings>4018;4244;4267;4715;4805</DisableSpecificWarnings>
9292
<TreatWarningAsError>true</TreatWarningAsError>
93-
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SECP256K1_STATIC;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;PROVIDE_FUZZ_MAIN_FUNCTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
93+
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SECP256K1_STATIC;ZMQ_STATIC;NOMINMAX;WIN32;_CRT_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;PROVIDE_FUZZ_MAIN_FUNCTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
9494
<AdditionalIncludeDirectories>..\..\src;..\..\src\minisketch\include;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
9595
</ClCompile>
9696
<Link>

src/addrdb.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#if defined(HAVE_CONFIG_H)
7-
#include <config/bitcoin-config.h>
8-
#endif
6+
#include <config/bitcoin-config.h> // IWYU pragma: keep
97

108
#include <addrdb.h>
119

src/addrman.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#if defined(HAVE_CONFIG_H)
7-
#include <config/bitcoin-config.h>
8-
#endif
6+
#include <config/bitcoin-config.h> // IWYU pragma: keep
97

108
#include <addrman.h>
119
#include <addrman_impl.h>

src/bench/wallet_create.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
44

5-
#if defined(HAVE_CONFIG_H)
6-
#include <config/bitcoin-config.h>
7-
#endif
5+
#include <config/bitcoin-config.h> // IWYU pragma: keep
86

97
#include <bench/bench.h>
108
#include <node/context.h>

src/bench/wallet_ismine.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#if defined(HAVE_CONFIG_H)
6-
#include <config/bitcoin-config.h>
7-
#endif // HAVE_CONFIG_H
5+
#include <config/bitcoin-config.h> // IWYU pragma: keep
86
#include <bench/bench.h>
97
#include <interfaces/chain.h>
108
#include <key.h>

src/bench/wallet_loading.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#if defined(HAVE_CONFIG_H)
6-
#include <config/bitcoin-config.h>
7-
#endif
5+
#include <config/bitcoin-config.h> // IWYU pragma: keep
86

97
#include <bench/bench.h>
108
#include <interfaces/chain.h>

src/bitcoin-cli.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#if defined(HAVE_CONFIG_H)
7-
#include <config/bitcoin-config.h>
8-
#endif
6+
#include <config/bitcoin-config.h> // IWYU pragma: keep
97

108
#include <chainparamsbase.h>
119
#include <clientversion.h>

src/bitcoin-tx.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#if defined(HAVE_CONFIG_H)
6-
#include <config/bitcoin-config.h>
7-
#endif
5+
#include <config/bitcoin-config.h> // IWYU pragma: keep
86

97
#include <chainparamsbase.h>
108
#include <clientversion.h>

0 commit comments

Comments
 (0)