diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index 6e240f67f80a..a2aac50ad37d 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -43,9 +43,15 @@ RUN apt-get update && apt-get install $APT_ARGS g++-arm-linux-gnueabihf && rm -r RUN apt-get update && apt-get install $APT_ARGS g++-mingw-w64-x86-64 && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS wine-stable wine32 wine64 bc nsis xorriso libncurses5 && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS python3-zmq && rm -rf /var/lib/apt/lists/* -RUN apt-get update && apt-get install $APT_ARGS cppcheck gawk jq && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install $APT_ARGS gawk jq && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools && rm -rf /var/lib/apt/lists/* +ARG CPPCHECK_VERSION=2.4 +RUN curl -sL "https://github.com/danmar/cppcheck/archive/${CPPCHECK_VERSION}.tar.gz" | tar -xvzf - --directory /tmp/ +RUN cd /tmp/cppcheck-${CPPCHECK_VERSION} && mkdir build && cd build && cmake .. && cmake --build . -j 8 +ENV PATH "/tmp/cppcheck-${CPPCHECK_VERSION}/build/bin:${PATH}" +RUN mkdir /usr/local/share/Cppcheck && ln -s /tmp/cppcheck-${CPPCHECK_VERSION}/cfg/ /usr/local/share/Cppcheck/cfg + ARG SHELLCHECK_VERSION=v0.7.1 RUN curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/ ENV PATH "/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}" diff --git a/src/bench/bls.cpp b/src/bench/bls.cpp index f395846b6758..eb4e65616d48 100644 --- a/src/bench/bls.cpp +++ b/src/bench/bls.cpp @@ -319,10 +319,10 @@ static void BLS_Verify_BatchedParallel(benchmark::Bench& bench) blsWorker.Start(); // Benchmark. - size_t i = 0; bench.minEpochIterations(1000).run([&] { if (futures.size() < 100) { while (futures.size() < 10000) { + size_t i = 0; auto f = blsWorker.AsyncVerifySig(sigs[i], pubKeys[i], msgHashes[i], cancelCond); futures.emplace_back(std::make_pair(i, std::move(f))); i = (i + 1) % pubKeys.size(); diff --git a/src/bench/bls_dkg.cpp b/src/bench/bls_dkg.cpp index 16a5c89bf36e..256deb17801b 100644 --- a/src/bench/bls_dkg.cpp +++ b/src/bench/bls_dkg.cpp @@ -54,7 +54,7 @@ class DKG } public: - DKG(int quorumSize) + explicit DKG(int quorumSize) { members.reserve(quorumSize); ids.reserve(quorumSize); diff --git a/src/bls/bls.h b/src/bls/bls.h index c313be377e77..e76d35f34083 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -320,7 +320,7 @@ class CBLSLazyWrapper bufValid = true; } - CBLSLazyWrapper(const CBLSLazyWrapper& r) + explicit CBLSLazyWrapper(const CBLSLazyWrapper& r) { *this = r; } diff --git a/src/bls/bls_worker.cpp b/src/bls/bls_worker.cpp index 8c6947c5cee8..373a01b78594 100644 --- a/src/bls/bls_worker.cpp +++ b/src/bls/bls_worker.cpp @@ -154,9 +154,9 @@ struct Aggregator : public std::enable_shared_from_this> { DoneCallback _doneCallback) : parallel(_parallel), workerPool(_workerPool), - doneCallback(std::move(_doneCallback)) + doneCallback(std::move(_doneCallback)), + inputVec(std::make_shared>(count)) { - inputVec = std::make_shared >(count); for (size_t i = 0; i < count; i++) { (*inputVec)[i] = pointer(_inputVec[start + i]); } diff --git a/src/cachemap.h b/src/cachemap.h index 5c8e8921dbe4..09a7eec42f75 100644 --- a/src/cachemap.h +++ b/src/cachemap.h @@ -123,7 +123,7 @@ class CacheMap if(it == mapIndex.end()) { return false; } - item_t& item = *(it->second); + const item_t& item = *(it->second); value = item.value; return true; } diff --git a/src/ctpl_stl.h b/src/ctpl_stl.h index a25145e29b32..d69c9744478f 100644 --- a/src/ctpl_stl.h +++ b/src/ctpl_stl.h @@ -73,7 +73,7 @@ namespace ctpl { public: thread_pool() { this->init(); } - thread_pool(int nThreads) { this->init(); this->resize(nThreads); } + explicit thread_pool(int nThreads) { this->init(); this->resize(nThreads); } // the destructor waits for all the functions in the queue to be finished ~thread_pool() { diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 0f53cd66c495..ad0e9216267d 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -695,7 +695,7 @@ class CDBTransaction { Clear(); } - bool IsClean() { + bool IsClean() const { return writes.empty() && deletes.empty(); } diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index 120f82b4d134..0fa38fc7952d 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -58,13 +58,13 @@ class CDeterministicMNState public: CDeterministicMNState() = default; - explicit CDeterministicMNState(const CProRegTx& proTx) + explicit CDeterministicMNState(const CProRegTx& proTx) : + keyIDOwner(proTx.keyIDOwner), + keyIDVoting(proTx.keyIDVoting), + addr(proTx.addr), + scriptPayout(proTx.scriptPayout) { - keyIDOwner = proTx.keyIDOwner; pubKeyOperator.Set(proTx.pubKeyOperator); - keyIDVoting = proTx.keyIDVoting; - addr = proTx.addr; - scriptPayout = proTx.scriptPayout; } template CDeterministicMNState(deserialize_type, Stream& s) @@ -228,7 +228,7 @@ class CDeterministicMN uint256 proTxHash; COutPoint collateralOutpoint; - uint16_t nOperatorReward; + uint16_t nOperatorReward{0}; CDeterministicMNStateCPtr pdmnState; template diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index d1fd99d98aa6..700a51737ebe 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -592,9 +592,9 @@ bool CGovernanceManager::ConfirmInventoryRequest(const CInv& inv) return false; } - auto it = setHash->find(inv.hash); - if (it == setHash->end()) { - setHash->insert(inv.hash); + const auto& [_, inserted] = setHash->insert(inv.hash); + + if (inserted) { LogPrint(BCLog::GOBJECT, "CGovernanceManager::ConfirmInventoryRequest added inv to requested set\n"); } diff --git a/src/governance/object.cpp b/src/governance/object.cpp index e904ae276f67..3a4033fc44dc 100644 --- a/src/governance/object.cpp +++ b/src/governance/object.cpp @@ -262,14 +262,12 @@ std::set CGovernanceObject::RemoveInvalidVotes(const COutPoint& mnOutpo mapCurrentMNVotes.erase(it); } - if (!removedVotes.empty()) { - std::string removedStr; - for (auto& h : removedVotes) { - removedStr += strprintf(" %s\n", h.ToString()); - } - LogPrintf("CGovernanceObject::%s -- Removed %d invalid votes for %s from MN %s:\n%s", __func__, removedVotes.size(), nParentHash.ToString(), mnOutpoint.ToString(), removedStr); /* Continued */ - fDirtyCache = true; + std::string removedStr; + for (auto& h : removedVotes) { + removedStr += strprintf(" %s\n", h.ToString()); } + LogPrintf("CGovernanceObject::%s -- Removed %d invalid votes for %s from MN %s:\n%s", __func__, removedVotes.size(), nParentHash.ToString(), mnOutpoint.ToString(), removedStr); /* Continued */ + fDirtyCache = true; return removedVotes; } diff --git a/src/hdchain.h b/src/hdchain.h index bb027b025779..ed5f9913111e 100644 --- a/src/hdchain.h +++ b/src/hdchain.h @@ -121,15 +121,15 @@ class CHDPubKey { private: static const int CURRENT_VERSION = 1; - int nVersion; + int nVersion{CHDPubKey::CURRENT_VERSION}; public: CExtPubKey extPubKey; uint256 hdchainID; - uint32_t nAccountIndex; - uint32_t nChangeIndex; + uint32_t nAccountIndex{0}; + uint32_t nChangeIndex{0}; - CHDPubKey() : nVersion(CHDPubKey::CURRENT_VERSION), nAccountIndex(0), nChangeIndex(0) {} + CHDPubKey() = default; SERIALIZE_METHODS(CHDPubKey, obj) { diff --git a/src/llmq/chainlocks.cpp b/src/llmq/chainlocks.cpp index e59d6dd9df46..eb392a541054 100644 --- a/src/llmq/chainlocks.cpp +++ b/src/llmq/chainlocks.cpp @@ -35,9 +35,9 @@ std::string CChainLockSig::ToString() const return strprintf("CChainLockSig(nHeight=%d, blockHash=%s)", nHeight, blockHash.ToString()); } -CChainLocksHandler::CChainLocksHandler() +CChainLocksHandler::CChainLocksHandler() : + scheduler(std::make_unique()) { - scheduler = std::make_unique(); CScheduler::Function serviceLoop = std::bind(&CScheduler::serviceQueue, scheduler.get()); scheduler_thread = std::make_unique(std::bind(&TraceThread, "cl-schdlr", serviceLoop)); } diff --git a/src/llmq/dkgsession.cpp b/src/llmq/dkgsession.cpp index c5c55082e58e..054bc029d6f7 100644 --- a/src/llmq/dkgsession.cpp +++ b/src/llmq/dkgsession.cpp @@ -470,12 +470,10 @@ void CDKGSession::VerifyConnectionAndMinProtoVersions() const if (m->dmn->proTxHash == myProTxHash) { continue; } - - auto it = protoMap.find(m->dmn->proTxHash); - if (it == protoMap.end()) { + if (auto it = protoMap.find(m->dmn->proTxHash); it == protoMap.end()) { m->badConnection = fShouldAllMembersBeConnected; logger.Batch("%s is not connected to us, badConnection=%b", m->dmn->proTxHash.ToString(), m->badConnection); - } else if (it != protoMap.end() && it->second < MIN_MASTERNODE_PROTO_VERSION) { + } else if (it->second < MIN_MASTERNODE_PROTO_VERSION) { m->badConnection = true; logger.Batch("%s does not have min proto version %d (has %d)", m->dmn->proTxHash.ToString(), MIN_MASTERNODE_PROTO_VERSION, it->second); } diff --git a/src/llmq/dkgsessionmgr.cpp b/src/llmq/dkgsessionmgr.cpp index c296366fea6d..392d181a8115 100644 --- a/src/llmq/dkgsessionmgr.cpp +++ b/src/llmq/dkgsessionmgr.cpp @@ -22,9 +22,9 @@ static const std::string DB_SKCONTRIB = "qdkg_S"; static const std::string DB_ENC_CONTRIB = "qdkg_E"; CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, bool unitTests, bool fWipe) : - blsWorker(_blsWorker) + db(std::make_unique(unitTests ? "" : (GetDataDir() / "llmq/dkgdb"), 1 << 20, unitTests, fWipe)), + blsWorker(_blsWorker) { - db = std::make_unique(unitTests ? "" : (GetDataDir() / "llmq/dkgdb"), 1 << 20, unitTests, fWipe); MigrateDKG(); for (const auto& qt : Params().GetConsensus().llmqs) { diff --git a/src/llmq/instantsend.cpp b/src/llmq/instantsend.cpp index 992aa1ab401e..0bdc464ec93c 100644 --- a/src/llmq/instantsend.cpp +++ b/src/llmq/instantsend.cpp @@ -54,10 +54,9 @@ uint256 CInstantSendLock::GetRequestId() const //////////////// -CInstantSendDb::CInstantSendDb(bool unitTests, bool fWipe) -{ - db = std::make_unique(unitTests ? "" : (GetDataDir() / "llmq/isdb"), 32 << 20, unitTests, fWipe); -} +CInstantSendDb::CInstantSendDb(bool unitTests, bool fWipe) : + db(std::make_unique(unitTests ? "" : (GetDataDir() / "llmq/isdb"), 32 << 20, unitTests, fWipe)) +{} void CInstantSendDb::Upgrade() { diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index d3385ceeaa40..75da9a2680a3 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -624,8 +624,7 @@ void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& strCommand, } if (strCommand == NetMsgType::QDATA) { - auto verifiedProRegTxHash = pFrom->GetVerifiedProRegTxHash(); - if ((!fMasternodeMode && !CLLMQUtils::IsWatchQuorumsEnabled()) || pFrom == nullptr || (verifiedProRegTxHash.IsNull() && !pFrom->qwatch)) { + if ((!fMasternodeMode && !CLLMQUtils::IsWatchQuorumsEnabled()) || pFrom == nullptr || (pFrom->GetVerifiedProRegTxHash().IsNull() && !pFrom->qwatch)) { errorHandler("Not a verified masternode or a qwatch connection"); return; } @@ -635,7 +634,7 @@ void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& strCommand, { LOCK2(cs_main, cs_data_requests); - auto it = mapQuorumDataRequests.find(std::make_pair(verifiedProRegTxHash, true)); + auto it = mapQuorumDataRequests.find(std::make_pair(pFrom->GetVerifiedProRegTxHash(), true)); if (it == mapQuorumDataRequests.end()) { errorHandler("Not requested"); return; diff --git a/src/llmq/quorums.h b/src/llmq/quorums.h index 78ba9617c284..fe323e822792 100644 --- a/src/llmq/quorums.h +++ b/src/llmq/quorums.h @@ -56,14 +56,14 @@ class CQuorumDataRequest }; private: - Consensus::LLMQType llmqType; + Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE}; uint256 quorumHash; - uint16_t nDataMask; + uint16_t nDataMask{0}; uint256 proTxHash; - Errors nError; + Errors nError{UNDEFINED}; - int64_t nTime; - bool fProcessed; + int64_t nTime{GetTime()}; + bool fProcessed{false}; static constexpr int64_t EXPIRATION_TIMEOUT{300}; @@ -74,10 +74,8 @@ class CQuorumDataRequest llmqType(llmqTypeIn), quorumHash(quorumHashIn), nDataMask(nDataMaskIn), - proTxHash(proTxHashIn), - nError(UNDEFINED), - nTime(GetTime()), - fProcessed(false) {} + proTxHash(proTxHashIn) + {} SERIALIZE_METHODS(CQuorumDataRequest, obj) { @@ -153,7 +151,7 @@ class CQuorum public: const Consensus::LLMQParams& params; CFinalCommitmentPtr qc; - const CBlockIndex* m_quorum_base_block_index; + const CBlockIndex* m_quorum_base_block_index{nullptr}; uint256 minedBlockHash; std::vector members; diff --git a/src/llmq/signing.cpp b/src/llmq/signing.cpp index 6a407575af79..f62f5ec3077d 100644 --- a/src/llmq/signing.cpp +++ b/src/llmq/signing.cpp @@ -38,9 +38,9 @@ UniValue CRecoveredSig::ToJson() const return ret; } -CRecoveredSigsDb::CRecoveredSigsDb(bool fMemory, bool fWipe) +CRecoveredSigsDb::CRecoveredSigsDb(bool fMemory, bool fWipe) : + db(std::make_unique(fMemory ? "" : (GetDataDir() / "llmq/recsigdb"), 8 << 20, fMemory, fWipe)) { - db = std::make_unique(fMemory ? "" : (GetDataDir() / "llmq/recsigdb"), 8 << 20, fMemory, fWipe); MigrateRecoveredSigs(); } diff --git a/src/masternode/sync.cpp b/src/masternode/sync.cpp index 64e694dff925..6496fc3ad630 100644 --- a/src/masternode/sync.cpp +++ b/src/masternode/sync.cpp @@ -16,10 +16,10 @@ class CMasternodeSync; CMasternodeSync masternodeSync; -CMasternodeSync::CMasternodeSync() +CMasternodeSync::CMasternodeSync() : + nTimeAssetSyncStarted(GetTime()), + nTimeLastBumped(GetTime()) { - nTimeAssetSyncStarted = GetTime(); - nTimeLastBumped = GetTime(); } void CMasternodeSync::Reset(bool fForce, bool fNotifyReset) diff --git a/src/netfulfilledman.cpp b/src/netfulfilledman.cpp index 92f8f8e44e08..336226c8be3b 100644 --- a/src/netfulfilledman.cpp +++ b/src/netfulfilledman.cpp @@ -27,17 +27,6 @@ bool CNetFulfilledRequestManager::HasFulfilledRequest(const CService& addr, cons it->second[strRequest] > GetTime(); } -void CNetFulfilledRequestManager::RemoveFulfilledRequest(const CService& addr, const std::string& strRequest) -{ - LOCK(cs_mapFulfilledRequests); - CService addrSquashed = Params().AllowMultiplePorts() ? addr : CService(addr, 0); - fulfilledreqmap_t::iterator it = mapFulfilledRequests.find(addrSquashed); - - if (it != mapFulfilledRequests.end()) { - it->second.erase(strRequest); - } -} - void CNetFulfilledRequestManager::RemoveAllFulfilledRequests(const CService& addr) { LOCK(cs_mapFulfilledRequests); diff --git a/src/netfulfilledman.h b/src/netfulfilledman.h index e1e13cd5866f..be25ce5c7cd2 100644 --- a/src/netfulfilledman.h +++ b/src/netfulfilledman.h @@ -24,8 +24,6 @@ class CNetFulfilledRequestManager fulfilledreqmap_t mapFulfilledRequests; mutable CCriticalSection cs_mapFulfilledRequests; - void RemoveFulfilledRequest(const CService& addr, const std::string& strRequest); - public: CNetFulfilledRequestManager() {} diff --git a/src/qt/governancelist.h b/src/qt/governancelist.h index 4f72946a60aa..608ed18d0f71 100644 --- a/src/qt/governancelist.h +++ b/src/qt/governancelist.h @@ -35,7 +35,7 @@ class Proposal : public QObject QString m_url; public: - Proposal(const CGovernanceObject* p, QObject* parent = nullptr); + explicit Proposal(const CGovernanceObject* p, QObject* parent = nullptr); QString title() const; QString hash() const; QDateTime startDate() const; diff --git a/src/stacktraces.cpp b/src/stacktraces.cpp index e81a2bce8ec6..619d1d874726 100644 --- a/src/stacktraces.cpp +++ b/src/stacktraces.cpp @@ -702,18 +702,18 @@ crash_info GetCrashInfoFromException(const std::exception_ptr& e) try { // rethrow and catch the exception as there is no other way to reliably cast to the real type (not possible with RTTI) std::rethrow_exception(e); - } catch (const std::exception& e) { + } catch (const std::exception& e2) { type = getExceptionType(); - what = GetExceptionWhat(e); - } catch (const std::string& e) { + what = GetExceptionWhat(e2); + } catch (const std::string& e2) { type = getExceptionType(); - what = GetExceptionWhat(e); - } catch (const char* e) { + what = GetExceptionWhat(e2); + } catch (const char* e2) { type = getExceptionType(); - what = GetExceptionWhat(e); - } catch (int e) { + what = GetExceptionWhat(e2); + } catch (int e2) { type = getExceptionType(); - what = GetExceptionWhat(e); + what = GetExceptionWhat(e2); } catch (...) { type = getExceptionType(); what = ""; @@ -740,7 +740,6 @@ static void terminate_handler() auto exc = std::current_exception(); crash_info ci; - ci.crashDescription = "std::terminate() called, aborting"; if (exc) { auto ci2 = GetCrashInfoFromException(exc); @@ -750,10 +749,9 @@ static void terminate_handler() } else { ci.crashDescription = "std::terminate() called due unknown reason"; ci.stackframes = GetStackFrames(0, 16); + ci.stackframeInfos = GetStackFrameInfos(ci.stackframes); } - ci.stackframeInfos = GetStackFrameInfos(ci.stackframes); - PrintCrashInfo(ci); skipAbortSignal = true; diff --git a/src/statsd_client.cpp b/src/statsd_client.cpp index 18a36361cab6..a2e34abecd22 100644 --- a/src/statsd_client.cpp +++ b/src/statsd_client.cpp @@ -74,9 +74,9 @@ struct _StatsdClientData { char errmsg[1024]; }; -StatsdClient::StatsdClient(const std::string& host, int port, const std::string& ns) +StatsdClient::StatsdClient(const std::string& host, int port, const std::string& ns) : + d(std::make_unique<_StatsdClientData>()) { - d = new _StatsdClientData; d->sock = INVALID_SOCKET; config(host, port, ns); } @@ -85,8 +85,6 @@ StatsdClient::~StatsdClient() { // close socket CloseSocket(d->sock); - delete d; - d = nullptr; } void StatsdClient::config(const std::string& host, int port, const std::string& ns) @@ -188,12 +186,12 @@ int StatsdClient::send(std::string key, size_t value, const std::string& type, f if ( fequal( sample_rate, 1.0 ) ) { snprintf(buf, sizeof(buf), "%s%s:%zd|%s", - d->ns.c_str(), key.c_str(), value, type.c_str()); + d->ns.c_str(), key.c_str(), (ssize_t) value, type.c_str()); } else { snprintf(buf, sizeof(buf), "%s%s:%zd|%s|@%.2f", - d->ns.c_str(), key.c_str(), value, type.c_str(), sample_rate); + d->ns.c_str(), key.c_str(), (ssize_t) value, type.c_str(), sample_rate); } return send(buf); diff --git a/src/statsd_client.h b/src/statsd_client.h index b7dfb15738b8..c5f5f58c0931 100644 --- a/src/statsd_client.h +++ b/src/statsd_client.h @@ -2,6 +2,7 @@ #define BITCOIN_STATSD_CLIENT_H #include +#include static const bool DEFAULT_STATSD_ENABLE = false; static const int DEFAULT_STATSD_PORT = 8125; @@ -56,7 +57,7 @@ class StatsdClient { static void cleanup(std::string& key); protected: - struct _StatsdClientData* d; + std::unique_ptr d; }; } // namespace statsd diff --git a/src/test/evo_deterministicmns_tests.cpp b/src/test/evo_deterministicmns_tests.cpp index e0d3f90c97e0..4ab0b172dba1 100644 --- a/src/test/evo_deterministicmns_tests.cpp +++ b/src/test/evo_deterministicmns_tests.cpp @@ -543,7 +543,6 @@ BOOST_FIXTURE_TEST_CASE(dip3_test_mempool_dual_proregtx, TestChainDIP3Setup) operatorKey.MakeNewKey(); auto scriptPayout = GetScriptForDestination(payoutKey.GetPubKey().GetID()); - auto scriptCollateral = GetScriptForDestination(collateralKey.GetPubKey().GetID()); CProRegTx payload; payload.addr = LookupNumeric("1.1.1.1", 2); diff --git a/test/lint/lint-cppcheck-dash.sh b/test/lint/lint-cppcheck-dash.sh index 4bdbb6641e0b..9389a28b3d0a 100755 --- a/test/lint/lint-cppcheck-dash.sh +++ b/test/lint/lint-cppcheck-dash.sh @@ -22,42 +22,74 @@ ENABLED_CHECKS=( "Unused variable" "The function '.*' overrides a function in a base class but is not marked with a 'override' specifier." # Enabale to catch all warnings -# ".*" -# We may choose to enable these in the future -# "Variable '.*' is assigned in constructor body. Consider performing initialization in initialization list." -# "Member variable '.*' is not initialized in the constructor." -# "Consider using std::copy algorithm instead of a raw loop." -# "Consider using std::any_of algorithm instead of a raw loop." -# "Consider using std::accumulate algorithm instead of a raw loop." -# "Consider using std::copy algorithm instead of a raw loop." -# "Consider using std::transform algorithm instead of a raw loop." -# "Consider using std::find_if algorithm instead of a raw loop." + ".*" ) IGNORED_WARNINGS=( "src/bls/bls.h:.* Struct 'CBLSIdImplicit' has a constructor with 1 argument that is not explicit." - "src/llmq/init.cpp:.* warning: Variable 'llmqDbTmp' is assigned a value that is never used." - "src/llmq/quorums.cpp:.* warning: Parameter '_blsWorker' can be declared with const" + "src/llmq/dkgsessionmgr.h:.* warning: struct member 'ContributionsCacheEntry::entryTime' is never used." + "src/llmq/instantsend.h:.* warning: struct member 'NonLockedTxInfo::pindexMined' is never used." + "src/rpc/masternode.cpp:.*:21: warning: Consider using std::copy algorithm instead of a raw loop." # UniValue doesn't support std::copy + "src/spork.h:.* warning: struct member 'CSporkDef::defaultValue' is never used." + "src/test/dip0020opcodes_tests.cpp:.* warning: There is an unknown macro here somewhere. Configuration is required. If BOOST_FIXTURE_TEST_SUITE is a macro then please configure it." + "src/ctpl_stl.h:.*22: warning: Dereferencing '_f' after it is deallocated / released" + # General catchall, for some reason any value named 'hash' is viewed as never used. "Variable 'hash' is assigned a value that is never used." # The following can be useful to ignore when the catch all is used # "Consider performing initialization in initialization list." -# "Consider using std::transform algorithm instead of a raw loop." -# "Consider using std::accumulate algorithm instead of a raw loop." + "Consider using std::transform algorithm instead of a raw loop." + "Consider using std::accumulate algorithm instead of a raw loop." # "Consider using std::any_of algorithm instead of a raw loop." # "Consider using std::count_if algorithm instead of a raw loop." -# "Member variable '.*' is not initialized in the constructor." # "Consider using std::find_if algorithm instead of a raw loop." +# "Member variable '.*' is not initialized in the constructor." ) # We should attempt to update this with all dash specific code -FILES=$(git ls-files -- "src/bls/*.cpp" "src/bls/*.h" "src/coinjoin/*.cpp" "src/coinjoin/*.h" "src/evo/*.cpp" \ - "src/evo/*.h" "src/governance/*.cpp" "src/governance/*.h" "src/llmq/*.cpp" "src/llmq/*.h" \ - "src/masternode/*.cpp" "src/masternode/*.h" "src/dsnotificationinterface.*" "src/spork.*" \ - "src/rpc/coinjoin.cpp" "src/rpc/governance.cpp" "src/rpc/masternode.cpp" "src/rpc/rpcevo.cpp" \ - "src/rpc/rpcquorums.cpp") +FILES=$(git ls-files -- "src/batchedlogger.*" \ + "src/bench/bls*.cpp" \ + "src/bls/*.cpp" \ + "src/bls/*.h" \ + "src/cachemap.h" \ + "src/cachemultimap.h" \ + "src/coinjoin/*.cpp" \ + "src/coinjoin/*.h" \ + "src/ctpl_stl.h" \ + "src/cxxtimer.hpp" \ + "src/dsnotificationinterface.*" \ + "src/evo/*.cpp" \ + "src/evo/*.h" \ + "src/governance/*.cpp" \ + "src/governance/*.h" \ + "src/hdchain.*" \ + "src/keepass.*" \ + "src/llmq/*.cpp" \ + "src/llmq/*.h" \ + "src/masternode/*.cpp" \ + "src/masternode/*.h" \ + "src/messagesigner.*" \ + "src/netfulfilledman.*" \ + "src/qt/governancelist.*" \ + "src/qt/masternodelist.*" \ + "src/rpc/coinjoin.cpp" \ + "src/rpc/governance.cpp" \ + "src/rpc/masternode.cpp" \ + "src/rpc/rpcevo.cpp" \ + "src/rpc/rpcquorums.cpp" \ + "src/spork.*" \ + "src/saltedhasher.*" \ + "src/stacktraces.*" \ + "src/statsd_client.*" \ + "src/test/block_reward_reallocation_tests.cpp" \ + "src/test/bls_tests.cpp" \ + "src/test/dip0020opcodes_tests.cpp" \ + "src/test/dynamic_activation*.cpp" \ + "src/test/evo*.cpp" \ + "src/test/governance*.cpp" \ + "src/unordered_lru_cache.h") if ! command -v cppcheck > /dev/null; then