Merge #16129: refactor: Remove unused includes (#4623)

67f4e9c522 Include core_io.h from core_read.cpp (practicalswift)
eca9767673 Make reasoning about dependencies easier by not including unused dependencies (practicalswift)

Pull request description:

  Make reasoning about dependencies easier by not including unused dependencies.

  Please note that the removed headers are _not_ "transitively included" by other still included headers. Thus the removals are real.

  As an added bonus this change means less work for the preprocessor/compiler. At least 51 393 lines of code no longer needs to be processed:

  ```
  $ git diff -u HEAD~1 | grep -E '^\-#include ' | cut -f2 -d"<" | cut -f1 -d">" | \
        sed 's%^%src/%g' | xargs cat | wc -l
  51393
  ```

  Note that 51 393 is the lower bound: the real number is likely much higher when taking into account transitively included headers :-)

ACKs for commit 67f4e9:

Tree-SHA512: 0c8868aac59813f099ce53d5307eed7962dd6f2ff3546768ef9e5c4508b87f8210f1a22c7e826c3c06bebbf28bdbfcf1628ed354c2d0fdb9a31a42cefb8fdf13

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This commit is contained in:
Vijay Manikpuri 2022-01-04 00:40:02 +05:30 committed by GitHub
parent db312c361e
commit 3148450032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 2 additions and 121 deletions

View File

@ -7,7 +7,6 @@
#include <hash.h>
#include <logging.h>
#include <streams.h>
#include <serialize.h>
int CAddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool> &asmap) const

View File

@ -6,7 +6,6 @@
#include <arith_uint256.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <crypto/common.h>

View File

@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <policy/policy.h>
#include <rpc/blockchain.h>
#include <txmempool.h>

View File

@ -4,7 +4,6 @@
#include <consensus/merkle.h>
#include <hash.h>
#include <util/strencodings.h>
/* WARNING! If you're reading this because you're learning about crypto
and/or designing a new system that will use merkle trees, keep in mind

View File

@ -12,7 +12,6 @@
#include <serialize.h>
#include <streams.h>
#include <univalue.h>
#include <util/moneystr.h>
#include <util/strencodings.h>
#include <spentindex.h>

View File

@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <crypto/aes.h>
#include <crypto/common.h>
#include <string.h>

View File

@ -3,7 +3,6 @@
#include <stdint.h>
#include <immintrin.h>
#include <crypto/sha256.h>
#include <crypto/common.h>
namespace sha256d64_avx2 {

View File

@ -3,7 +3,6 @@
#include <stdint.h>
#include <immintrin.h>
#include <crypto/sha256.h>
#include <crypto/common.h>
namespace sha256d64_sse41 {

View File

@ -8,7 +8,6 @@
#include <chainparams.h>
#include <chainparamsbase.h>
#include <consensus/consensus.h>
#include <logging.h>
#include <util/system.h>
#include <util/strencodings.h>

View File

@ -13,15 +13,11 @@
#include <compat.h>
#include <init.h>
#include <interfaces/chain.h>
#include <rpc/server.h>
#include <noui.h>
#include <shutdown.h>
#include <util/system.h>
#include <httpserver.h>
#include <httprpc.h>
#include <util/strencodings.h>
#include <util/threadnames.h>
#include <walletinitinterface.h>
#include <stacktraces.h>
#include <stdio.h>

View File

@ -8,7 +8,6 @@
#include <httpserver.h>
#include <rpc/protocol.h>
#include <rpc/server.h>
#include <random.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <ui_interface.h>

View File

@ -70,7 +70,6 @@
#include <messagesigner.h>
#include <netfulfilledman.h>
#include <spork.h>
#include <warnings.h>
#include <walletinitinterface.h>
#include <evo/deterministicmns.h>

View File

@ -26,7 +26,6 @@
#include <policy/settings.h>
#include <primitives/block.h>
#include <rpc/server.h>
#include <scheduler.h>
#include <shutdown.h>
#include <sync.h>
#include <txmempool.h>

View File

@ -9,11 +9,8 @@
#include <consensus/validation.h>
#include <interfaces/chain.h>
#include <interfaces/handler.h>
#include <net.h>
#include <policy/fees.h>
#include <primitives/transaction.h>
#include <rpc/server.h>
#include <scheduler.h>
#include <script/ismine.h>
#include <script/standard.h>
#include <support/allocators/secure.h>

View File

@ -5,7 +5,6 @@
#include <key.h>
#include <arith_uint256.h>
#include <crypto/common.h>
#include <crypto/hmac_sha512.h>
#include <random.h>

View File

@ -7,7 +7,6 @@
#include <hash.h>
#include <consensus/consensus.h>
#include <util/strencodings.h>
std::vector<unsigned char> BitsToBytes(const std::vector<bool>& bits)

View File

@ -21,7 +21,6 @@
#include <util/system.h>
#include <util/moneystr.h>
#include <util/validation.h>
#include <validationinterface.h>
#include <evo/specialtx.h>
#include <evo/cbtx.h>

View File

@ -28,7 +28,6 @@
#include <index/txindex.h>
#include <txmempool.h>
#include <util/system.h>
#include <util/moneystr.h>
#include <util/strencodings.h>
#include <util/validation.h>

View File

@ -6,7 +6,6 @@
#include <netbase.h>
#include <sync.h>
#include <uint256.h>
#include <tinyformat.h>
#include <util/system.h>
#include <util/strencodings.h>

View File

@ -9,7 +9,6 @@
#include <coins.h>
#include <policy/settings.h>
#include <util/strencodings.h>
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)

View File

@ -8,7 +8,6 @@
#include <hash.h>
#include <streams.h>
#include <tinyformat.h>
#include <util/strencodings.h>
uint256 CBlockHeader::GetHash() const
{

View File

@ -11,7 +11,6 @@
#include <qt/forms/ui_addressbookpage.h>
#include <qt/addresstablemodel.h>
#include <qt/bitcoingui.h>
#include <qt/csvmodelwriter.h>
#include <qt/editaddressdialog.h>
#include <qt/guiutil.h>

View File

@ -8,7 +8,6 @@
#include <qt/guiutil.h>
#include <qt/walletmodel.h>
#include <interfaces/node.h>
#include <key_io.h>
#include <algorithm>

View File

@ -5,8 +5,6 @@
#include <qt/bantablemodel.h>
#include <qt/clientmodel.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <interfaces/node.h>

View File

@ -5,7 +5,6 @@
#include <qt/bitcoinunits.h>
#include <chainparams.h>
#include <primitives/transaction.h>
#include <QSettings>
#include <QStringList>

View File

@ -12,19 +12,13 @@
#include <evo/deterministicmns.h>
#include <chain.h>
#include <chainparams.h>
#include <clientversion.h>
#include <governance/object.h>
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <net.h>
#include <netbase.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <util/system.h>
#include <validation.h>
#include <warnings.h>
#include <stdint.h>

View File

@ -11,19 +11,15 @@
#include <qt/forms/ui_coincontroldialog.h>
#include <qt/addresstablemodel.h>
#include <base58.h>
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <txmempool.h>
#include <qt/walletmodel.h>
#include <wallet/coincontrol.h>
#include <interfaces/node.h>
#include <key_io.h>
#include <policy/policy.h>
#include <validation.h> // For mempool
#include <wallet/fees.h>
#include <wallet/wallet.h>
#include <QApplication>

View File

@ -31,14 +31,10 @@
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <noui.h>
#include <rpc/server.h>
#include <stacktraces.h>
#include <ui_interface.h>
#include <uint256.h>
#include <util/system.h>
#include <warnings.h>
#include <walletinitinterface.h>
#include <memory>
#include <stdint.h>

View File

@ -5,9 +5,7 @@
#include <qt/receivecoinsdialog.h>
#include <qt/forms/ui_receivecoinsdialog.h>
#include <qt/addressbookpage.h>
#include <qt/addresstablemodel.h>
#include <qt/bitcoinunits.h>
#include <qt/optionsmodel.h>
#include <qt/receiverequestdialog.h>
#include <qt/recentrequeststablemodel.h>

View File

@ -4,8 +4,6 @@
#include <interfaces/chain.h>
#include <interfaces/node.h>
#include <qt/addressbookpage.h>
#include <qt/addresstablemodel.h>
#include <qt/editaddressdialog.h>
#include <qt/optionsmodel.h>
#include <qt/qvalidatedlineedit.h>

View File

@ -5,7 +5,6 @@
#include <qt/test/apptests.h>
#include <chainparams.h>
#include <init.h>
#include <key.h>
#include <qt/dash.h>
#include <qt/bitcoingui.h>
@ -19,9 +18,6 @@
#if defined(HAVE_CONFIG_H)
#include <config/dash-config.h>
#endif
#ifdef ENABLE_WALLET
#include <wallet/db.h>
#endif
#include <QAction>
#include <QEventLoop>

View File

@ -4,11 +4,7 @@
#include <qt/test/rpcnestedtests.h>
#include <chainparams.h>
#include <consensus/validation.h>
#include <interfaces/node.h>
#include <validation.h>
#include <rpc/register.h>
#include <rpc/server.h>
#include <qt/rpcconsole.h>
#include <test/setup_common.h>

View File

@ -2,10 +2,8 @@
#include <qt/test/util.h>
#include <coinjoin/client.h>
#include <init.h>
#include <interfaces/chain.h>
#include <interfaces/node.h>
#include <base58.h>
#include <qt/bitcoinamountfield.h>
#include <qt/clientmodel.h>
#include <qt/optionsmodel.h>

View File

@ -6,11 +6,8 @@
#include <qt/transactionrecord.h>
#include <chain.h>
#include <consensus/consensus.h>
#include <interfaces/wallet.h>
#include <interfaces/node.h>
#include <timedata.h>
#include <validation.h>
#include <stdint.h>

View File

@ -12,11 +12,8 @@
#include <core_io.h>
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <sync.h>
#include <uint256.h>
#include <util/system.h>
#include <validation.h>
#include <algorithm>

View File

@ -12,17 +12,13 @@
#include <qt/forms/ui_helpmessagedialog.h>
#include <qt/bitcoingui.h>
#include <qt/clientmodel.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/intro.h>
#ifdef ENABLE_BIP70
#include <qt/paymentrequestplus.h>
#endif
#include <clientversion.h>
#include <init.h>
#include <interfaces/node.h>
#include <util/system.h>
#include <util/strencodings.h>

View File

@ -8,7 +8,6 @@
#include <qt/walletmodeltransaction.h>
#include <interfaces/node.h>
#include <key_io.h>
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients) :

View File

@ -10,7 +10,6 @@
#include <httpserver.h>
#include <key_io.h>
#include <net.h>
#include <netbase.h>
#include <rpc/blockchain.h>
#include <rpc/server.h>
#include <rpc/util.h>

View File

@ -6,7 +6,6 @@
#include <rpc/server.h>
#include <banman.h>
#include <chainparams.h>
#include <clientversion.h>
#include <core_io.h>
#include <net.h>
@ -18,7 +17,6 @@
#include <rpc/util.h>
#include <sync.h>
#include <timedata.h>
#include <ui_interface.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <validation.h>

View File

@ -12,7 +12,6 @@
#include <core_io.h>
#include <index/txindex.h>
#include <init.h>
#include <interfaces/chain.h>
#include <key_io.h>
#include <keystore.h>
#include <merkleblock.h>

View File

@ -7,7 +7,6 @@
#include <rpc/server.h>
#include <chainparams.h>
#include <random.h>
#include <rpc/util.h>
#include <shutdown.h>
#include <sync.h>

View File

@ -7,7 +7,6 @@
#include <pubkey.h>
#include <script/script.h>
#include <util/strencodings.h>
typedef std::vector<unsigned char> valtype;

View File

@ -4,7 +4,6 @@
#include <clientversion.h>
#include <coins.h>
#include <consensus/validation.h>
#include <script/standard.h>
#include <streams.h>
#include <test/setup_common.h>

View File

@ -9,7 +9,6 @@
#include <keystore.h>
#include <net.h>
#include <net_processing.h>
#include <pow.h>
#include <script/sign.h>
#include <util/memory.h>
#include <util/system.h>

View File

@ -9,7 +9,6 @@
#include <script/script_error.h>
#include <script/interpreter.h>
#include <script/sign.h>
#include <script/ismine.h>
#include <tinyformat.h>
#include <uint256.h>
#include <test/setup_common.h>

View File

@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <consensus/tx_verify.h>
#include <core_io.h>
#include <key.h>
#include <keystore.h>
#include <validation.h>

View File

@ -20,7 +20,6 @@
#include <rpc/server.h>
#include <script/sigcache.h>
#include <streams.h>
#include <ui_interface.h>
#include <txdb.h>
#include <util/memory.h>
#include <util/strencodings.h>

View File

@ -8,7 +8,6 @@
#include <script/standard.h>
#include <script/sign.h>
#include <test/setup_common.h>
#include <core_io.h>
#include <keystore.h>
#include <boost/test/unit_test.hpp>

View File

@ -6,11 +6,9 @@
#include <chainparams.h>
#include <consensus/merkle.h>
#include <consensus/validation.h>
#include <key_io.h>
#include <miner.h>
#include <pow.h>
#include <scheduler.h>
#include <script/standard.h>
#include <validation.h>
#ifdef ENABLE_WALLET

View File

@ -12,7 +12,6 @@
#include <sync.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <warnings.h>

View File

@ -5,8 +5,6 @@
#include <txdb.h>
#include <chainparams.h>
#include <hash.h>
#include <random.h>
#include <pow.h>
#include <shutdown.h>

View File

@ -13,8 +13,6 @@
#include <policy/fees.h>
#include <policy/settings.h>
#include <reverse_iterator.h>
#include <streams.h>
#include <timedata.h>
#include <util/system.h>
#include <util/moneystr.h>
#include <util/time.h>

View File

@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <ui_interface.h>
#include <util/system.h>
#include <boost/signals2/last_value.hpp>
#include <boost/signals2/signal.hpp>

View File

@ -9,8 +9,6 @@
#include <support/allocators/secure.h>
#include <chainparamsbase.h>
#include <ctpl_stl.h>
#include <random.h>
#include <serialize.h>
#include <stacktraces.h>
#include <util/getuniquepath.h>
#include <util/strencodings.h>

View File

@ -8,7 +8,6 @@
#include <primitives/block.h>
#include <scheduler.h>
#include <txmempool.h>
#include <validation.h>
#include <future>

View File

@ -5,10 +5,7 @@
#include <wallet/db.h>
#include <hash.h>
#include <protocol.h>
#include <util/strencodings.h>
#include <wallet/walletutil.h>
#include <stdint.h>

View File

@ -5,8 +5,6 @@
#include <wallet/fees.h>
#include <policy/policy.h>
#include <validation.h>
#include <wallet/coincontrol.h>
#include <wallet/wallet.h>

View File

@ -6,7 +6,6 @@
#include <init.h>
#include <interfaces/chain.h>
#include <net.h>
#include <scheduler.h>
#include <util/error.h>
#include <util/system.h>
#include <util/moneystr.h>

View File

@ -18,7 +18,6 @@
#include <rpc/server.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <timedata.h>
#include <util/fees.h>
#include <util/system.h>
#include <util/moneystr.h>

View File

@ -8,9 +8,6 @@
#include <util/system.h>
#include <wallet/test/init_test_fixture.h>
#include <wallet/wallet.h>
BOOST_FIXTURE_TEST_SUITE(init_tests, InitWalletDirTestingSetup)
BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)

View File

@ -5,7 +5,6 @@
#include <key_io.h>
#include <util/strencodings.h>
#include <wallet/psbtwallet.h>
#include <wallet/rpcwallet.h>
#include <wallet/wallet.h>
#include <boost/test/unit_test.hpp>

View File

@ -4,8 +4,6 @@
#include <wallet/test/wallet_test_fixture.h>
#include <rpc/server.h>
#include <wallet/rpcwallet.h>
WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
: TestingSetup(chainName),

View File

@ -17,7 +17,6 @@
#include <key.h>
#include <key_io.h>
#include <keystore.h>
#include <net.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/settings.h>
@ -25,8 +24,6 @@
#include <primitives/transaction.h>
#include <script/script.h>
#include <script/sign.h>
#include <shutdown.h>
#include <timedata.h>
#include <txmempool.h>
#include <util/error.h>
#include <util/fees.h>

View File

@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <base58.h>
#include <fs.h>
#include <interfaces/chain.h>
#include <util/system.h>

View File

@ -4,7 +4,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <sync.h>
#include <clientversion.h>
#include <util/system.h>
#include <warnings.h>
#include <hash.h>

View File

@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <zmq/zmqabstractnotifier.h>
#include <util/system.h>
#include <cassert>

View File

@ -9,7 +9,6 @@
#include <zmq.h>
#include <validation.h>
#include <streams.h>
#include <util/system.h>
CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(nullptr)

View File

@ -12,7 +12,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"chainparamsbase -> util/system -> chainparamsbase"
"index/txindex -> validation -> index/txindex"
"policy/fees -> txmempool -> policy/fees"
"policy/policy -> policy/settings -> policy/policy"
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
"qt/bantablemodel -> qt/clientmodel -> qt/bantablemodel"
"qt/bitcoingui -> qt/utilitydialog -> qt/bitcoingui"
@ -24,15 +23,10 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
"qt/walletmodel -> qt/walletmodeltransaction -> qt/walletmodel"
"txmempool -> validation -> txmempool"
"validation -> validationinterface -> validation"
"wallet/fees -> wallet/wallet -> wallet/fees"
"wallet/wallet -> wallet/walletdb -> wallet/wallet"
"wallet/coincontrol -> wallet/wallet -> wallet/coincontrol"
"qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/addressbookpage"
"txmempool -> validation -> validationinterface -> txmempool"
"qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/receivecoinsdialog -> qt/addressbookpage"
"qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/signverifymessagedialog -> qt/addressbookpage"
"qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/sendcoinsdialog -> qt/sendcoinsentry -> qt/addressbookpage"
# Dash
"coinjoin/server -> net_processing -> coinjoin/server"
"evo/cbtx -> evo/simplifiedmns -> evo/cbtx"
@ -65,7 +59,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"llmq/signing -> net_processing -> llmq/signing"
"llmq/signing_shares -> net_processing -> llmq/signing_shares"
"logging -> util/system -> logging"
"logging -> util/system -> random -> logging"
"masternode/payments -> validation -> masternode/payments"
"net -> netmessagemaker -> net"
"net_processing -> spork -> net_processing"
@ -79,9 +72,9 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"core_io -> evo/cbtx -> evo/simplifiedmns -> core_io"
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/simplifiedmns"
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsessionhandler -> llmq/dkgsession"
"logging -> util/system -> random -> logging"
"logging -> util/system -> sync -> logging"
"logging -> util/system -> stacktraces -> logging"
"logging -> util/system -> util/getuniquepath -> random -> logging"
"coinjoin/client -> coinjoin/util -> wallet/wallet -> coinjoin/client"
"qt/appearancewidget -> qt/guiutil -> qt/optionsdialog -> qt/appearancewidget"
"qt/guiutil -> qt/optionsdialog -> qt/optionsmodel -> qt/guiutil"
@ -103,6 +96,7 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"evo/deterministicmns -> llmq/utils -> net -> masternode/sync -> evo/deterministicmns"
"evo/mnhftx -> evo/specialtx -> evo/mnhftx"
"policy/fees -> txmempool -> validation -> policy/fees"
"policy/policy -> policy/settings -> policy/policy"
"bloom -> evo/specialtx -> llmq/blockprocessor -> net -> bloom"
"bloom -> evo/specialtx -> llmq/blockprocessor -> net_processing -> merkleblock -> bloom"
)