mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #20584: Declare de facto const reference variables/member functions as const
31b136e580Don't declare de facto const reference variables as non-const (practicalswift)1c65c075eeDon't declare de facto const member functions as non-const (practicalswift) Pull request description: _Meta: This is the second and final part of the `const` refactoring series (part one: #20581). **I promise: no more refactoring PRs from me in a while! :)** I'll now go back to focusing on fuzzing/hardening!_ Changes in this PR: * Don't declare de facto const member functions as non-const * Don't declare de facto const reference variables as non-const Awards for finding candidates for the above changes go to: * `clang-tidy`'s [`readability-make-member-function-const`](https://clang.llvm.org/extra/clang-tidy/checks/readability-make-member-function-const.html) check ([list of `clang-tidy` checks](https://clang.llvm.org/extra/clang-tidy/checks/list.html)) * `cppcheck`'s `constVariable` check ([list of `cppcheck` checks](https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/)) See #18920 for instructions on how to analyse Bitcoin Core using Clang Static Analysis, `clang-tidy` and `cppcheck`. ACKs for top commit: ajtowns: ACK31b136e580jonatack: ACK31b136e580theStack: ACK31b136e580❄️ Tree-SHA512: f58f8f00744219426874379e9f3e9331132b9b48e954d24f3a85cbb858fdcc98009ed42ef7e7b4619ae8af9fc240a6d8bfc1c438db2e97b0ecd722a80dcfeffe
This commit is contained in:
@@ -26,7 +26,7 @@ static const unsigned int QUEUE_BATCH_SIZE = 128;
|
||||
static const int SCRIPT_CHECK_THREADS = 3;
|
||||
|
||||
struct FakeCheck {
|
||||
bool operator()()
|
||||
bool operator()() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ struct FailingCheck {
|
||||
bool fails;
|
||||
FailingCheck(bool _fails) : fails(_fails){};
|
||||
FailingCheck() : fails(true){};
|
||||
bool operator()()
|
||||
bool operator()() const
|
||||
{
|
||||
return !fails;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ struct UniqueCheck {
|
||||
struct MemoryCheck {
|
||||
static std::atomic<size_t> fake_allocated_memory;
|
||||
bool b {false};
|
||||
bool operator()()
|
||||
bool operator()() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ struct FrozenCleanupCheck {
|
||||
// Freezing can't be the default initialized behavior given how the queue
|
||||
// swaps in default initialized Checks.
|
||||
bool should_freeze {false};
|
||||
bool operator()()
|
||||
bool operator()() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -239,12 +239,12 @@ TestChain100Setup::~TestChain100Setup()
|
||||
gArgs.ForceSetArg("-segwitheight", "0");
|
||||
}
|
||||
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx)
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx) const
|
||||
{
|
||||
return FromTx(MakeTransactionRef(tx));
|
||||
}
|
||||
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx)
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx) const
|
||||
{
|
||||
return CTxMemPoolEntry(tx, nFee, nTime, nHeight,
|
||||
spendsCoinbase, sigOpCost, lp);
|
||||
|
||||
@@ -145,8 +145,8 @@ struct TestMemPoolEntryHelper
|
||||
nFee(0), nTime(0), nHeight(1),
|
||||
spendsCoinbase(false), sigOpCost(4) { }
|
||||
|
||||
CTxMemPoolEntry FromTx(const CMutableTransaction& tx);
|
||||
CTxMemPoolEntry FromTx(const CTransactionRef& tx);
|
||||
CTxMemPoolEntry FromTx(const CMutableTransaction& tx) const;
|
||||
CTxMemPoolEntry FromTx(const CTransactionRef& tx) const;
|
||||
|
||||
// Change the default value
|
||||
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
|
||||
|
||||
Reference in New Issue
Block a user