diff options
| -rwxr-xr-x | contrib/devtools/lint-includes.sh | 43 | ||||
| -rw-r--r-- | src/chainparams.cpp | 1 | ||||
| -rw-r--r-- | src/chainparamsbase.cpp | 1 | ||||
| -rw-r--r-- | src/init.cpp | 1 | ||||
| -rw-r--r-- | src/interfaces/handler.cpp | 1 | ||||
| -rw-r--r-- | src/interfaces/wallet.cpp | 2 | ||||
| -rw-r--r-- | src/miner.cpp | 1 | ||||
| -rw-r--r-- | src/net.cpp | 1 | ||||
| -rw-r--r-- | src/qt/paymentrequestplus.cpp | 1 | ||||
| -rw-r--r-- | src/random.cpp | 1 | ||||
| -rw-r--r-- | src/support/lockedpool.cpp | 1 | ||||
| -rw-r--r-- | src/test/test_bitcoin.cpp | 2 | ||||
| -rw-r--r-- | src/wallet/db.cpp | 1 | ||||
| -rw-r--r-- | src/wallet/test/wallet_test_fixture.cpp | 1 | ||||
| -rw-r--r-- | src/wallet/wallet.cpp | 2 |
15 files changed, 43 insertions, 17 deletions
diff --git a/contrib/devtools/lint-includes.sh b/contrib/devtools/lint-includes.sh new file mode 100755 index 000000000..baca2f8a1 --- /dev/null +++ b/contrib/devtools/lint-includes.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Copyright (c) 2018 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# +# Check for duplicate includes. + +filter_suffix() { + git ls-files | grep -E "^src/.*\.${1}"'$' | grep -Ev "/(leveldb|secp256k1|univalue)/" +} + +EXIT_CODE=0 +for HEADER_FILE in $(filter_suffix h); do + DUPLICATE_INCLUDES_IN_HEADER_FILE=$(grep -E "^#include " < "${HEADER_FILE}" | sort | uniq -d) + if [[ ${DUPLICATE_INCLUDES_IN_HEADER_FILE} != "" ]]; then + echo "Duplicate include(s) in ${HEADER_FILE}:" + echo "${DUPLICATE_INCLUDES_IN_HEADER_FILE}" + echo + EXIT_CODE=1 + fi + CPP_FILE=${HEADER_FILE/%\.h/.cpp} + if [[ ! -e $CPP_FILE ]]; then + continue + fi + DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES=$(grep -hE "^#include " <(sort -u < "${HEADER_FILE}") <(sort -u < "${CPP_FILE}") | grep -E "^#include " | sort | uniq -d) + if [[ ${DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES} != "" ]]; then + echo "Include(s) from ${HEADER_FILE} duplicated in ${CPP_FILE}:" + echo "${DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES}" + echo + EXIT_CODE=1 + fi +done +for CPP_FILE in $(filter_suffix cpp); do + DUPLICATE_INCLUDES_IN_CPP_FILE=$(grep -E "^#include " < "${CPP_FILE}" | sort | uniq -d) + if [[ ${DUPLICATE_INCLUDES_IN_CPP_FILE} != "" ]]; then + echo "Duplicate include(s) in ${CPP_FILE}:" + echo "${DUPLICATE_INCLUDES_IN_CPP_FILE}" + echo + EXIT_CODE=1 + fi +done +exit ${EXIT_CODE} diff --git a/src/chainparams.cpp b/src/chainparams.cpp index adf8e6ae5..6067503b0 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -11,7 +11,6 @@ #include <utilstrencodings.h> #include <assert.h> -#include <memory> #include <chainparamsseeds.h> diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index c51a3fc96..e840a2ed3 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -9,7 +9,6 @@ #include <util.h> #include <assert.h> -#include <memory> const std::string CBaseChainParams::MAIN = "main"; const std::string CBaseChainParams::TESTNET = "test"; diff --git a/src/init.cpp b/src/init.cpp index 9684b0c70..9b6216d65 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -47,7 +47,6 @@ #include <walletinitinterface.h> #include <stdint.h> #include <stdio.h> -#include <memory> #ifndef WIN32 #include <signal.h> diff --git a/src/interfaces/handler.cpp b/src/interfaces/handler.cpp index 1443fe9f1..8e45faa2a 100644 --- a/src/interfaces/handler.cpp +++ b/src/interfaces/handler.cpp @@ -7,7 +7,6 @@ #include <util.h> #include <boost/signals2/connection.hpp> -#include <memory> #include <utility> namespace interfaces { diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 0244fe70f..21543552d 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -22,8 +22,6 @@ #include <wallet/feebumper.h> #include <wallet/wallet.h> -#include <memory> - namespace interfaces { namespace { diff --git a/src/miner.cpp b/src/miner.cpp index d2be39353..0660df928 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -27,7 +27,6 @@ #include <validationinterface.h> #include <algorithm> -#include <memory> #include <queue> #include <utility> diff --git a/src/net.cpp b/src/net.cpp index f45592ab8..342dfbaeb 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -20,7 +20,6 @@ #include <ui_interface.h> #include <utilstrencodings.h> -#include <memory> #ifdef WIN32 #include <string.h> #else diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp index 357e98a53..b0ef475b3 100644 --- a/src/qt/paymentrequestplus.cpp +++ b/src/qt/paymentrequestplus.cpp @@ -9,7 +9,6 @@ #include <qt/paymentrequestplus.h> -#include <script/script.h> #include <util.h> #include <stdexcept> diff --git a/src/random.cpp b/src/random.cpp index a845526d8..b004dcac3 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -15,7 +15,6 @@ #include <utilstrencodings.h> // for GetTime() #include <stdlib.h> -#include <limits> #include <chrono> #include <thread> diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index 51c337ed2..f10fd07c6 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -27,7 +27,6 @@ #endif #include <algorithm> -#include <memory> LockedPoolManager* LockedPoolManager::_instance = nullptr; std::once_flag LockedPoolManager::init_flag; diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 9390a93b9..4c758b995 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -17,8 +17,6 @@ #include <rpc/register.h> #include <script/sigcache.h> -#include <memory> - void CConnmanTest::AddNode(CNode& node) { LOCK(g_connman->cs_vNodes); diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 553cae4d0..91dde4542 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -8,7 +8,6 @@ #include <addrman.h> #include <hash.h> #include <protocol.h> -#include <util.h> #include <utilstrencodings.h> #include <wallet/walletutil.h> diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp index 5c550742c..1452c5b54 100644 --- a/src/wallet/test/wallet_test_fixture.cpp +++ b/src/wallet/test/wallet_test_fixture.cpp @@ -6,7 +6,6 @@ #include <rpc/server.h> #include <wallet/db.h> -#include <wallet/wallet.h> WalletTestingSetup::WalletTestingSetup(const std::string& chainName): TestingSetup(chainName), m_wallet("mock", CWalletDBWrapper::CreateMock()) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 894dfb035..5485eb797 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -8,7 +8,6 @@ #include <checkpoints.h> #include <chain.h> #include <wallet/coincontrol.h> -#include <wallet/coinselection.h> #include <consensus/consensus.h> #include <consensus/validation.h> #include <fs.h> @@ -26,7 +25,6 @@ #include <scheduler.h> #include <timedata.h> #include <txmempool.h> -#include <util.h> #include <utilmoneystr.h> #include <wallet/fees.h> |