From dddd40ba8267dea11a3eb03d5cf8b51dbb99be5d Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 26 Feb 2024 13:36:30 +0100 Subject: [PATCH 1/2] scripted-diff: Add IWYU pragma keep to bitcoin-config.h includes -BEGIN VERIFY SCRIPT- perl -0777 -pi -e 's/#if defined\(HAVE_CONFIG_H\)\n#include .*\n#endif.*\n/#include \/\/ IWYU pragma: keep\n/g' $( git grep -l '#include ' ) -END VERIFY SCRIPT- --- src/addrdb.cpp | 4 +--- src/addrman.cpp | 4 +--- src/bench/wallet_create.cpp | 4 +--- src/bench/wallet_ismine.cpp | 4 +--- src/bench/wallet_loading.cpp | 4 +--- src/bitcoin-cli.cpp | 4 +--- src/bitcoin-tx.cpp | 4 +--- src/bitcoin-util.cpp | 4 +--- src/bitcoin-wallet.cpp | 4 +--- src/bitcoind.cpp | 4 +--- src/clientversion.cpp | 4 +--- src/clientversion.h | 4 +--- src/common/run_command.cpp | 4 +--- src/common/settings.cpp | 4 +--- src/common/system.cpp | 4 +--- src/common/system.h | 4 +--- src/crypto/sha256.cpp | 4 +--- src/httpserver.cpp | 4 +--- src/init.cpp | 4 +--- src/init/common.cpp | 4 +--- src/mapport.cpp | 4 +--- src/net.cpp | 4 +--- src/netbase.cpp | 4 +--- src/node/interfaces.cpp | 4 +--- src/node/kernel_notifications.cpp | 4 +--- src/qt/bitcoin.cpp | 4 +--- src/qt/bitcoin.h | 4 +--- src/qt/bitcoingui.cpp | 4 +--- src/qt/bitcoingui.h | 4 +--- src/qt/clientmodel.cpp | 4 +--- src/qt/createwalletdialog.cpp | 4 +--- src/qt/guiutil.cpp | 4 +--- src/qt/intro.cpp | 4 +--- src/qt/modaloverlay.cpp | 4 +--- src/qt/notificator.cpp | 4 +--- src/qt/notificator.h | 4 +--- src/qt/optionsdialog.cpp | 4 +--- src/qt/optionsmodel.cpp | 4 +--- src/qt/qrimagewidget.cpp | 4 +--- src/qt/receiverequestdialog.cpp | 4 +--- src/qt/rpcconsole.cpp | 4 +--- src/qt/rpcconsole.h | 4 +--- src/qt/sendcoinsdialog.cpp | 4 +--- src/qt/splashscreen.cpp | 4 +--- src/qt/test/optiontests.cpp | 4 +--- src/qt/test/test_main.cpp | 4 +--- src/qt/utilitydialog.cpp | 4 +--- src/random.cpp | 4 +--- src/randomenv.cpp | 4 +--- src/rest.cpp | 4 +--- src/rpc/external_signer.cpp | 4 +--- src/rpc/mining.cpp | 4 +--- src/rpc/node.cpp | 4 +--- src/rpc/register.h | 4 +--- src/rpc/server.cpp | 4 +--- src/rpc/util.cpp | 4 +--- src/test/system_tests.cpp | 4 +--- src/test/util/setup_common.cpp | 4 +--- src/test/util_threadnames_tests.cpp | 4 +--- src/util/check.cpp | 4 +--- src/util/fs_helpers.cpp | 4 +--- src/util/syserror.cpp | 4 +--- src/util/threadnames.cpp | 4 +--- src/util/tokenpipe.cpp | 4 +--- src/util/trace.h | 4 +--- src/validation.cpp | 4 +--- src/wallet/init.cpp | 4 +--- src/wallet/rpc/addresses.cpp | 4 +--- src/wallet/rpc/backup.cpp | 4 +--- src/wallet/rpc/wallet.cpp | 4 +--- src/wallet/sqlite.cpp | 4 +--- src/wallet/test/db_tests.cpp | 4 +--- src/wallet/test/util.h | 4 +--- src/wallet/wallet.cpp | 4 +--- src/wallet/walletdb.cpp | 4 +--- src/wallet/wallettool.cpp | 4 +--- src/warnings.cpp | 4 +--- 77 files changed, 77 insertions(+), 231 deletions(-) diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 14dc314c36..4d34c24ba9 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 ef8ed92bb5..eb9c372550 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 32f55f51e1..85280e5835 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 3f922e18a5..753404b526 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 6305126c7d..02582deda4 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 8901d10ef6..c7ba2204c3 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 320624c419..1c5b0c074c 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 96387e8c71..c8f5bc5026 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 fe90958a5f..bee052bc46 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 54796c5abb..7685bdea79 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 bf5579ee69..3a5e060a39 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 9da0cd0b39..73aaf868e4 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 347b486095..67608b985f 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 db1001111a..c1520dacd2 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 1fa53a5f34..ddd0feda3b 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 83280d46ee..d9115d3b33 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 301f22a248..c883bd2f03 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 71134d442f..b1d4dc9234 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 4d7638cd6e..1637d8369c 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 0800cd93d8..3a6df3e8bd 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 08b365db4b..80670230c7 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 1eda98253a..4a42ddec2c 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 f0fa298378..e231766487 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 4d2d83812e..40927c990a 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -52,9 +52,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 99f909ff75..6578b383f7 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 b1a8461d02..44a858c16b 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 9622c9d57d..1423a8bbc6 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 5f132b817e..a43009d954 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 ba91eeb1ff..73adbda5a5 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 05172cfbd2..2f3bad37e6 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 6557280d89..3e8d1461e5 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 e094b686d4..ee841ce626 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 5371dbaa30..26b42deb64 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 667db06574..7bc6ccdc49 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 551c0ffd13..85bdeee49a 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 1fd8181a22..8808716aa4 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 dd654a7abe..15103baf59 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 d0f7c64357..0c21c6748d 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 00f928b355..f6e712a047 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 3453857f98..b4322ddc0f 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 bafef62945..702ca44395 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 358f68c3c8..d6a5035c33 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 89bd35eb1b..0d8c0f7a63 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 8872f8be32..ffd6689910 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 5f9f2cb449..0f82f65f3e 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 c5405cca98..f310d0a02b 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 22fe219def..b55b4cbe64 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 4fc9099704..239d5bc6fe 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 123b5cc06c..aeec959c28 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 89c033b8a3..9fc5d4af04 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 8d06ae4258..27c7394909 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 454c262803..b908265c4b 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 ffc2ee5ab0..447be2cf64 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 fd23dde75b..65fd29ff08 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 e7d1e3db4e..a800451f4a 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 f683878054..a81300e3bf 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 2de147deea..baa759e42c 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 38350b33cc..0fb5e4eb45 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 45d3a58fd3..df5b1a4461 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 c4d4b0cc28..eb3885832b 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 bce5602462..8952f20f79 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 bac498a23d..6f3a724483 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 91883fe4ff..ea597dd05a 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 3c27d5e523..16fbb664ea 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 b7c275f19b..d9ed65e3aa 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 f57851b4f7..c2b56555a2 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 f151fad740..14e988ec1a 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 bed9ec029a..65587f0b18 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 ae2dfe5795..c05600484e 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 a684d4e191..f1cb595271 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 34f18bf0b1..5e3a8179a2 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 f783424df8..438dfceb7f 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 9f2974ece6..a3e6ede81e 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 8f4171eb15..45f69f52d1 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 b1ce7ee4e7..3ba43cdb73 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 cda344ab19..7a1930fd31 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 d55eecc48d..da41b02b27 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 From fa09451f8e6799682d7e7c863f25334fd1c7dce3 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 26 Feb 2024 14:25:51 +0100 Subject: [PATCH 2/2] Add lint check for bitcoin-config.h include IWYU pragma Also, remove the no longer needed, remaining definitions and checks of HAVE_CONFIG_H. --- build-aux/m4/bitcoin_qt.m4 | 2 +- build_msvc/bitcoin-qt/bitcoin-qt.vcxproj | 4 ++-- build_msvc/common.init.vcxproj.in | 2 +- test/lint/test_runner/src/main.rs | 12 ++++++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index a716cd9a27..337e2208a9 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 fe01da28c8..ff98d37cf8 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 71fceb6c66..6468abcd06 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/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 "; 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 ));