diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index a716cd9a277..337e2208a9c 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -227,7 +227,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes) BITCOIN_QT_PATH_PROGS([LCONVERT], [lconvert-qt5 lconvert5 lconvert], $qt_bin_path, yes) - MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)' + MOC_DEFS='-I$(srcdir)' case $host in *darwin*) BITCOIN_QT_CHECK([ diff --git a/build_msvc/bitcoin-qt/bitcoin-qt.vcxproj b/build_msvc/bitcoin-qt/bitcoin-qt.vcxproj index fe01da28c88..ff98d37cf89 100644 --- a/build_msvc/bitcoin-qt/bitcoin-qt.vcxproj +++ b/build_msvc/bitcoin-qt/bitcoin-qt.vcxproj @@ -62,7 +62,7 @@ ..\..\src; - HAVE_CONFIG_H;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -75,7 +75,7 @@ ..\..\src; - HAVE_CONFIG_H;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _UNICODE;UNICODE;%(PreprocessorDefinitions) diff --git a/build_msvc/common.init.vcxproj.in b/build_msvc/common.init.vcxproj.in index 71fceb6c660..6468abcd061 100644 --- a/build_msvc/common.init.vcxproj.in +++ b/build_msvc/common.init.vcxproj.in @@ -90,7 +90,7 @@ /utf-8 /Zc:preprocessor /Zc:__cplusplus /std:c++20 %(AdditionalOptions) 4018;4244;4267;4715;4805 true - _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) + _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) ..\..\src;..\..\src\minisketch\include;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;%(AdditionalIncludeDirectories) diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 14dc314c365..4d34c24ba95 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/addrman.cpp b/src/addrman.cpp index ef8ed92bb53..eb9c3725507 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bench/wallet_create.cpp b/src/bench/wallet_create.cpp index d7e772ac827..618d5bc80ce 100644 --- a/src/bench/wallet_create.cpp +++ b/src/bench/wallet_create.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or https://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bench/wallet_ismine.cpp b/src/bench/wallet_ismine.cpp index 3f922e18a58..753404b5261 100644 --- a/src/bench/wallet_ismine.cpp +++ b/src/bench/wallet_ismine.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif // HAVE_CONFIG_H +#include // IWYU pragma: keep #include #include #include diff --git a/src/bench/wallet_loading.cpp b/src/bench/wallet_loading.cpp index 6305126c7d4..02582deda4a 100644 --- a/src/bench/wallet_loading.cpp +++ b/src/bench/wallet_loading.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 8901d10ef63..c7ba2204c3f 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 320624c419b..1c5b0c074c9 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bitcoin-util.cpp b/src/bitcoin-util.cpp index 96387e8c71e..c8f5bc50262 100644 --- a/src/bitcoin-util.cpp +++ b/src/bitcoin-util.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index fe90958a5f5..bee052bc46d 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 54796c5abbf..7685bdea79c 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/clientversion.cpp b/src/clientversion.cpp index bf5579ee697..3a5e060a397 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/clientversion.h b/src/clientversion.h index 9da0cd0b394..73aaf868e49 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -7,9 +7,7 @@ #include -#if defined(HAVE_CONFIG_H) -#include -#endif //HAVE_CONFIG_H +#include // IWYU pragma: keep // Check that required client information is defined #if !defined(CLIENT_VERSION_MAJOR) || !defined(CLIENT_VERSION_MINOR) || !defined(CLIENT_VERSION_BUILD) || !defined(CLIENT_VERSION_IS_RELEASE) || !defined(COPYRIGHT_YEAR) diff --git a/src/common/run_command.cpp b/src/common/run_command.cpp index 347b4860955..67608b985fb 100644 --- a/src/common/run_command.cpp +++ b/src/common/run_command.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/common/settings.cpp b/src/common/settings.cpp index db1001111a2..c1520dacd25 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -4,9 +4,7 @@ #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/common/system.cpp b/src/common/system.cpp index 1fa53a5f34c..ddd0feda3b8 100644 --- a/src/common/system.cpp +++ b/src/common/system.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/common/system.h b/src/common/system.h index 83280d46ee0..d9115d3b333 100644 --- a/src/common/system.h +++ b/src/common/system.h @@ -6,9 +6,7 @@ #ifndef BITCOIN_COMMON_SYSTEM_H #define BITCOIN_COMMON_SYSTEM_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 301f22a2488..c883bd2f03f 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 71134d442fe..b1d4dc92347 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/init.cpp b/src/init.cpp index 1e6d2965514..fbf25a0341f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/init/common.cpp b/src/init/common.cpp index 0800cd93d8b..3a6df3e8bd5 100644 --- a/src/init/common.cpp +++ b/src/init/common.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/mapport.cpp b/src/mapport.cpp index 08b365db4b6..80670230c73 100644 --- a/src/mapport.cpp +++ b/src/mapport.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/net.cpp b/src/net.cpp index a3b1fe6d169..ad1e4646678 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/netbase.cpp b/src/netbase.cpp index f0fa2983783..e231766487f 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index bb13e537382..84fc92e69d6 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -53,9 +53,7 @@ #include #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/node/kernel_notifications.cpp b/src/node/kernel_notifications.cpp index 99f909ff75c..6578b383f7a 100644 --- a/src/node/kernel_notifications.cpp +++ b/src/node/kernel_notifications.cpp @@ -4,9 +4,7 @@ #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index b1a8461d029..44a858c16b3 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/bitcoin.h b/src/qt/bitcoin.h index 9622c9d57d7..1423a8bbc69 100644 --- a/src/qt/bitcoin.h +++ b/src/qt/bitcoin.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_QT_BITCOIN_H #define BITCOIN_QT_BITCOIN_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 5f132b817e0..a43009d9542 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index ba91eeb1ffa..73adbda5a5f 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_QT_BITCOINGUI_H #define BITCOIN_QT_BITCOINGUI_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 05172cfbd27..2f3bad37e6a 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/createwalletdialog.cpp b/src/qt/createwalletdialog.cpp index 6557280d891..3e8d1461e5a 100644 --- a/src/qt/createwalletdialog.cpp +++ b/src/qt/createwalletdialog.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index e094b686d40..ee841ce626b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 5371dbaa304..26b42deb641 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index 667db06574e..7bc6ccdc494 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 551c0ffd137..85bdeee49a0 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/notificator.h b/src/qt/notificator.h index 1fd8181a226..8808716aa4d 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_QT_NOTIFICATOR_H #define BITCOIN_QT_NOTIFICATOR_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index dd654a7abe2..15103baf593 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index d0f7c64357e..0c21c6748d0 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/qrimagewidget.cpp b/src/qt/qrimagewidget.cpp index 00f928b3557..f6e712a047a 100644 --- a/src/qt/qrimagewidget.cpp +++ b/src/qt/qrimagewidget.cpp @@ -15,9 +15,7 @@ #include #include -#if defined(HAVE_CONFIG_H) -#include /* for USE_QRCODE */ -#endif +#include // IWYU pragma: keep #ifdef USE_QRCODE #include diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 3453857f985..b4322ddc0f4 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -14,9 +14,7 @@ #include #include -#if defined(HAVE_CONFIG_H) -#include /* for USE_QRCODE */ -#endif +#include // IWYU pragma: keep ReceiveRequestDialog::ReceiveRequestDialog(QWidget* parent) : QDialog(parent, GUIUtil::dialog_flags), diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index bafef62945a..702ca44395d 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 358f68c3c8c..d6a5035c33d 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_QT_RPCCONSOLE_H #define BITCOIN_QT_RPCCONSOLE_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 89bd35eb1bc..0d8c0f7a636 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 8872f8be321..ffd6689910b 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/qt/test/optiontests.cpp b/src/qt/test/optiontests.cpp index 5f9f2cb4491..0f82f65f3ea 100644 --- a/src/qt/test/optiontests.cpp +++ b/src/qt/test/optiontests.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index c5405cca984..f310d0a02b7 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 22fe219def8..b55b4cbe64d 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/random.cpp b/src/random.cpp index 4fc90997048..239d5bc6fe9 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 123b5cc06c1..aeec959c28c 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/rest.cpp b/src/rest.cpp index 89c033b8a31..9fc5d4af047 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/rpc/external_signer.cpp b/src/rpc/external_signer.cpp index 8d06ae42589..27c73949099 100644 --- a/src/rpc/external_signer.cpp +++ b/src/rpc/external_signer.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index f36665a819a..73987669a51 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index ffc2ee5ab07..447be2cf644 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/rpc/register.h b/src/rpc/register.h index fd23dde75b7..65fd29ff08f 100644 --- a/src/rpc/register.h +++ b/src/rpc/register.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_RPC_REGISTER_H #define BITCOIN_RPC_REGISTER_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep /** These are in one header file to avoid creating tons of single-function * headers for everything under src/rpc/ */ diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index e7d1e3db4e5..a800451f4a0 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 0ac2c4e7b0d..22ec4e69674 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/test/system_tests.cpp b/src/test/system_tests.cpp index 2de147deeae..baa759e42c2 100644 --- a/src/test/system_tests.cpp +++ b/src/test/system_tests.cpp @@ -3,9 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. // -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include #include diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 38350b33cc5..0fb5e4eb45e 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/test/util_threadnames_tests.cpp b/src/test/util_threadnames_tests.cpp index 45d3a58fd3c..df5b1a4461d 100644 --- a/src/test/util_threadnames_tests.cpp +++ b/src/test/util_threadnames_tests.cpp @@ -11,9 +11,7 @@ #include #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/util/check.cpp b/src/util/check.cpp index c4d4b0cc28f..eb3885832b2 100644 --- a/src/util/check.cpp +++ b/src/util/check.cpp @@ -4,9 +4,7 @@ #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/util/fs_helpers.cpp b/src/util/fs_helpers.cpp index bce56024620..8952f20f799 100644 --- a/src/util/fs_helpers.cpp +++ b/src/util/fs_helpers.cpp @@ -5,9 +5,7 @@ #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/util/syserror.cpp b/src/util/syserror.cpp index bac498a23d1..6f3a7244836 100644 --- a/src/util/syserror.cpp +++ b/src/util/syserror.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/util/threadnames.cpp b/src/util/threadnames.cpp index 91883fe4ffd..ea597dd05a7 100644 --- a/src/util/threadnames.cpp +++ b/src/util/threadnames.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp index 3c27d5e5231..16fbb664ea1 100644 --- a/src/util/tokenpipe.cpp +++ b/src/util/tokenpipe.cpp @@ -3,9 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #ifndef WIN32 diff --git a/src/util/trace.h b/src/util/trace.h index b7c275f19b7..d9ed65e3aab 100644 --- a/src/util/trace.h +++ b/src/util/trace.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_UTIL_TRACE_H #define BITCOIN_UTIL_TRACE_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #ifdef ENABLE_TRACING diff --git a/src/validation.cpp b/src/validation.cpp index f57851b4f7e..c2b56555a2c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index f151fad7402..14e988ec1aa 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index bed9ec029aa..65587f0b188 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp index ae2dfe57951..c05600484ea 100644 --- a/src/wallet/rpc/backup.cpp +++ b/src/wallet/rpc/backup.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index a684d4e191a..f1cb595271e 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/wallet/sqlite.cpp b/src/wallet/sqlite.cpp index 34f18bf0b1c..5e3a8179a27 100644 --- a/src/wallet/sqlite.cpp +++ b/src/wallet/sqlite.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/wallet/test/db_tests.cpp b/src/wallet/test/db_tests.cpp index f783424df8b..438dfceb7ff 100644 --- a/src/wallet/test/db_tests.cpp +++ b/src/wallet/test/db_tests.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/wallet/test/util.h b/src/wallet/test/util.h index 9f2974ece6b..a3e6ede81ef 100644 --- a/src/wallet/test/util.h +++ b/src/wallet/test/util.h @@ -5,9 +5,7 @@ #ifndef BITCOIN_WALLET_TEST_UTIL_H #define BITCOIN_WALLET_TEST_UTIL_H -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8f4171eb15d..45f69f52d1d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5,9 +5,7 @@ #include -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include #include #include diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index b1ce7ee4e70..3ba43cdb73e 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index cda344ab19c..7a1930fd316 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -2,9 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/src/warnings.cpp b/src/warnings.cpp index 0b1af9b9f0d..38c0554cf21 100644 --- a/src/warnings.cpp +++ b/src/warnings.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif +#include // IWYU pragma: keep #include diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs index f054f99011a..d5dd98effe2 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 "; 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 // IWYU pragma: keep$" + } else { + "#include " // 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 // IWYU pragma: keep "#, defines_regex ));