aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-07-11 19:08:46 +0100
committermerge-script <fanquake@gmail.com>2024-07-11 19:08:46 +0100
commit01dc38bd01b05953585b1b6ec0468ec9d516e9a3 (patch)
tree3a0f7201400bbf62009be357356da41421ab4f89
parentc2c0b4f0029957ecd3870fadd62b822f26f3aa7a (diff)
parent3333bae9b2a6c1ee2314d33361c93944c12001f9 (diff)
Merge bitcoin/bitcoin#30406: refactor: modernize-use-equals-default
3333bae9b2a6c1ee2314d33361c93944c12001f9 tidy: modernize-use-equals-default (MarcoFalke) Pull request description: Prior to C++20, `modernize-use-equals-default` could have been problematic because it could turn a non-aggregate into an aggregate. The risk would be that aggregate initialization would be enabled where the author did not intend to enable it. With C++20, aggregate for those is forbidden either way. (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1008r1.pdf) So enabled it for code clarity, consistency, and possibly unlocking compiler optimizations. See https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html ACKs for top commit: stickies-v: ACK 3333bae9b2a6c1ee2314d33361c93944c12001f9 Tree-SHA512: ab42ff01be7ca7e7d8b4c6a485e68426f59627d83dd827cf292304829562348dc17a52ee009f5f6f3c1c2081d7166ffac4baef23197ebeba8de7767c6ddfe255
-rw-r--r--src/.clang-tidy1
-rw-r--r--src/arith_uint256.h2
-rw-r--r--src/blockencodings.h4
-rw-r--r--src/chain.h2
-rw-r--r--src/coins.h4
-rw-r--r--src/crypto/muhash.h2
-rw-r--r--src/crypto/sha3.h2
-rw-r--r--src/flatfile.h2
-rw-r--r--src/headerssync.h2
-rw-r--r--src/httpserver.h2
-rw-r--r--src/index/disktxpos.h2
-rw-r--r--src/interfaces/chain.h6
-rw-r--r--src/interfaces/echo.h2
-rw-r--r--src/interfaces/handler.h2
-rw-r--r--src/interfaces/mining.h2
-rw-r--r--src/interfaces/node.h4
-rw-r--r--src/interfaces/wallet.h2
-rw-r--r--src/kernel/chainparams.h2
-rw-r--r--src/kernel/notifications_interface.h2
-rw-r--r--src/merkleblock.h2
-rw-r--r--src/net.h2
-rw-r--r--src/net_processing.h2
-rw-r--r--src/net_types.h2
-rw-r--r--src/policy/fees.h2
-rw-r--r--src/prevector.h2
-rw-r--r--src/primitives/block.h2
-rw-r--r--src/psbt.h6
-rw-r--r--src/qt/transactiondesc.h2
-rw-r--r--src/rpc/server.h4
-rw-r--r--src/script/interpreter.h2
-rw-r--r--src/script/miniscript.h2
-rw-r--r--src/script/script.h4
-rw-r--r--src/script/sign.h4
-rw-r--r--src/script/signingprovider.h2
-rw-r--r--src/serialize.h2
-rw-r--r--src/streams.h2
-rw-r--r--src/support/lockedpool.cpp4
-rw-r--r--src/support/lockedpool.h2
-rw-r--r--src/sync.h2
-rw-r--r--src/threadsafety.h2
-rw-r--r--src/tinyformat.h3
-rw-r--r--src/util/subprocess.h2
-rw-r--r--src/util/task_runner.h2
-rw-r--r--src/validationinterface.cpp2
-rw-r--r--src/wallet/coinselection.h2
-rw-r--r--src/wallet/db.h10
-rw-r--r--src/wallet/migrate.h6
-rw-r--r--src/wallet/scriptpubkeyman.h2
-rw-r--r--src/wallet/sqlite.h4
-rw-r--r--src/wallet/test/util.h6
-rw-r--r--src/wallet/walletutil.h2
-rw-r--r--src/walletinitinterface.h2
-rw-r--r--src/zmq/zmqnotificationinterface.cpp4
53 files changed, 72 insertions, 76 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 61adce1d50..81bdd5fdf1 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -10,6 +10,7 @@ misc-unused-using-decls,
misc-no-recursion,
modernize-use-default-member-init,
modernize-use-emplace,
+modernize-use-equals-default,
modernize-use-noexcept,
modernize-use-nullptr,
performance-*,
diff --git a/src/arith_uint256.h b/src/arith_uint256.h
index ba36cebbdc..a6d67e3fa3 100644
--- a/src/arith_uint256.h
+++ b/src/arith_uint256.h
@@ -240,7 +240,7 @@ public:
/** 256-bit unsigned big integer. */
class arith_uint256 : public base_uint<256> {
public:
- arith_uint256() {}
+ arith_uint256() = default;
arith_uint256(const base_uint<256>& b) : base_uint<256>(b) {}
arith_uint256(uint64_t b) : base_uint<256>(b) {}
diff --git a/src/blockencodings.h b/src/blockencodings.h
index bc1d08ba5a..c92aa05e80 100644
--- a/src/blockencodings.h
+++ b/src/blockencodings.h
@@ -59,7 +59,7 @@ public:
uint256 blockhash;
std::vector<CTransactionRef> txn;
- BlockTransactions() {}
+ BlockTransactions() = default;
explicit BlockTransactions(const BlockTransactionsRequest& req) :
blockhash(req.blockhash), txn(req.indexes.size()) {}
@@ -109,7 +109,7 @@ public:
/**
* Dummy for deserialization
*/
- CBlockHeaderAndShortTxIDs() {}
+ CBlockHeaderAndShortTxIDs() = default;
/**
* @param[in] nonce This should be randomly generated, and is used for the siphash secret key
diff --git a/src/chain.h b/src/chain.h
index bb70dbd8bc..e8a8c066c8 100644
--- a/src/chain.h
+++ b/src/chain.h
@@ -66,7 +66,7 @@ public:
READWRITE(VARINT(obj.nTimeLast));
}
- CBlockFileInfo() {}
+ CBlockFileInfo() = default;
std::string ToString() const;
diff --git a/src/coins.h b/src/coins.h
index c798cc38ba..76e64b641d 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -154,7 +154,7 @@ class CCoinsViewCursor
{
public:
CCoinsViewCursor(const uint256 &hashBlockIn): hashBlock(hashBlockIn) {}
- virtual ~CCoinsViewCursor() {}
+ virtual ~CCoinsViewCursor() = default;
virtual bool GetKey(COutPoint &key) const = 0;
virtual bool GetValue(Coin &coin) const = 0;
@@ -198,7 +198,7 @@ public:
virtual std::unique_ptr<CCoinsViewCursor> Cursor() const;
//! As we use CCoinsViews polymorphically, have a virtual destructor
- virtual ~CCoinsView() {}
+ virtual ~CCoinsView() = default;
//! Estimate database size (0 if not implemented)
virtual size_t EstimateSize() const { return 0; }
diff --git a/src/crypto/muhash.h b/src/crypto/muhash.h
index cb53e1743e..222b866b6d 100644
--- a/src/crypto/muhash.h
+++ b/src/crypto/muhash.h
@@ -97,7 +97,7 @@ private:
public:
/* The empty set. */
- MuHash3072() noexcept {};
+ MuHash3072() noexcept = default;
/* A singleton with variable sized data in it. */
explicit MuHash3072(Span<const unsigned char> in) noexcept;
diff --git a/src/crypto/sha3.h b/src/crypto/sha3.h
index e8e91f1ee4..a28c5311ff 100644
--- a/src/crypto/sha3.h
+++ b/src/crypto/sha3.h
@@ -32,7 +32,7 @@ private:
public:
static constexpr size_t OUTPUT_SIZE = 32;
- SHA3_256() {}
+ SHA3_256() = default;
SHA3_256& Write(Span<const unsigned char> data);
SHA3_256& Finalize(Span<unsigned char> output);
SHA3_256& Reset();
diff --git a/src/flatfile.h b/src/flatfile.h
index 26b466db71..a9d7edd306 100644
--- a/src/flatfile.h
+++ b/src/flatfile.h
@@ -18,7 +18,7 @@ struct FlatFilePos
SERIALIZE_METHODS(FlatFilePos, obj) { READWRITE(VARINT_MODE(obj.nFile, VarIntMode::NONNEGATIVE_SIGNED), VARINT(obj.nPos)); }
- FlatFilePos() {}
+ FlatFilePos() = default;
FlatFilePos(int nFileIn, unsigned int nPosIn) :
nFile(nFileIn),
diff --git a/src/headerssync.h b/src/headerssync.h
index e93f67e6da..5e399eb861 100644
--- a/src/headerssync.h
+++ b/src/headerssync.h
@@ -100,7 +100,7 @@ struct CompressedHeader {
class HeadersSyncState {
public:
- ~HeadersSyncState() {}
+ ~HeadersSyncState() = default;
enum class State {
/** PRESYNC means the peer has not yet demonstrated their chain has
diff --git a/src/httpserver.h b/src/httpserver.h
index 907ed1a72b..33216a0119 100644
--- a/src/httpserver.h
+++ b/src/httpserver.h
@@ -156,7 +156,7 @@ class HTTPClosure
{
public:
virtual void operator()() = 0;
- virtual ~HTTPClosure() {}
+ virtual ~HTTPClosure() = default;
};
/** Event class. This can be used either as a cross-thread trigger or as a timer.
diff --git a/src/index/disktxpos.h b/src/index/disktxpos.h
index 1004f7ae87..a03638469e 100644
--- a/src/index/disktxpos.h
+++ b/src/index/disktxpos.h
@@ -20,7 +20,7 @@ struct CDiskTxPos : public FlatFilePos
CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
}
- CDiskTxPos() {}
+ CDiskTxPos() = default;
};
#endif // BITCOIN_INDEX_DISKTXPOS_H
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index 9da5cb9637..af45f81f95 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -123,7 +123,7 @@ struct BlockInfo {
class Chain
{
public:
- virtual ~Chain() {}
+ virtual ~Chain() = default;
//! Get current chain height, not including genesis block (returns 0 if
//! chain only contains genesis block, nullopt if chain does not contain
@@ -309,7 +309,7 @@ public:
class Notifications
{
public:
- virtual ~Notifications() {}
+ virtual ~Notifications() = default;
virtual void transactionAddedToMempool(const CTransactionRef& tx) {}
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) {}
virtual void blockConnected(ChainstateRole role, const BlockInfo& block) {}
@@ -371,7 +371,7 @@ public:
class ChainClient
{
public:
- virtual ~ChainClient() {}
+ virtual ~ChainClient() = default;
//! Register rpcs.
virtual void registerRpcs() = 0;
diff --git a/src/interfaces/echo.h b/src/interfaces/echo.h
index 5578d9d9e6..964dbb02fa 100644
--- a/src/interfaces/echo.h
+++ b/src/interfaces/echo.h
@@ -13,7 +13,7 @@ namespace interfaces {
class Echo
{
public:
- virtual ~Echo() {}
+ virtual ~Echo() = default;
//! Echo provided string.
virtual std::string echo(const std::string& echo) = 0;
diff --git a/src/interfaces/handler.h b/src/interfaces/handler.h
index 7751d82347..6fc14ed0b4 100644
--- a/src/interfaces/handler.h
+++ b/src/interfaces/handler.h
@@ -22,7 +22,7 @@ namespace interfaces {
class Handler
{
public:
- virtual ~Handler() {}
+ virtual ~Handler() = default;
//! Disconnect the handler.
virtual void disconnect() = 0;
diff --git a/src/interfaces/mining.h b/src/interfaces/mining.h
index 7d71a01450..974490561a 100644
--- a/src/interfaces/mining.h
+++ b/src/interfaces/mining.h
@@ -26,7 +26,7 @@ namespace interfaces {
class Mining
{
public:
- virtual ~Mining() {}
+ virtual ~Mining() = default;
//! If this chain is exclusively used for testing
virtual bool isTestChain() = 0;
diff --git a/src/interfaces/node.h b/src/interfaces/node.h
index 2bb895dd47..a56e79148d 100644
--- a/src/interfaces/node.h
+++ b/src/interfaces/node.h
@@ -59,7 +59,7 @@ struct BlockAndHeaderTipInfo
class ExternalSigner
{
public:
- virtual ~ExternalSigner() {};
+ virtual ~ExternalSigner() = default;
//! Get signer display name
virtual std::string getName() = 0;
@@ -69,7 +69,7 @@ public:
class Node
{
public:
- virtual ~Node() {}
+ virtual ~Node() = default;
//! Init logging.
virtual void initLogging() = 0;
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index f7bcca58cf..c573d6aa65 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -65,7 +65,7 @@ using WalletValueMap = std::map<std::string, std::string>;
class Wallet
{
public:
- virtual ~Wallet() {}
+ virtual ~Wallet() = default;
//! Encrypt wallet.
virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0;
diff --git a/src/kernel/chainparams.h b/src/kernel/chainparams.h
index 05ebd07ec7..5d45a1fa9c 100644
--- a/src/kernel/chainparams.h
+++ b/src/kernel/chainparams.h
@@ -163,7 +163,7 @@ public:
static std::unique_ptr<const CChainParams> TestNet();
protected:
- CChainParams() {}
+ CChainParams() = default;
Consensus::Params consensus;
MessageStartChars pchMessageStart;
diff --git a/src/kernel/notifications_interface.h b/src/kernel/notifications_interface.h
index 8e090dd7db..ef72d9bdb6 100644
--- a/src/kernel/notifications_interface.h
+++ b/src/kernel/notifications_interface.h
@@ -35,7 +35,7 @@ bool IsInterrupted(const T& result)
class Notifications
{
public:
- virtual ~Notifications(){};
+ virtual ~Notifications() = default;
[[nodiscard]] virtual InterruptResult blockTip(SynchronizationState state, CBlockIndex& index) { return {}; }
virtual void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) {}
diff --git a/src/merkleblock.h b/src/merkleblock.h
index 12b41a581e..945b7d3341 100644
--- a/src/merkleblock.h
+++ b/src/merkleblock.h
@@ -147,7 +147,7 @@ public:
// Create from a CBlock, matching the txids in the set
CMerkleBlock(const CBlock& block, const std::set<Txid>& txids) : CMerkleBlock{block, nullptr, &txids} {}
- CMerkleBlock() {}
+ CMerkleBlock() = default;
SERIALIZE_METHODS(CMerkleBlock, obj) { READWRITE(obj.header, obj.txn); }
diff --git a/src/net.h b/src/net.h
index 0c3bf5cbc8..34ddd5c80d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -250,7 +250,7 @@ public:
/** The Transport converts one connection's sent messages to wire bytes, and received bytes back. */
class Transport {
public:
- virtual ~Transport() {}
+ virtual ~Transport() = default;
struct Info
{
diff --git a/src/net_processing.h b/src/net_processing.h
index bf9698ee02..a413db98e8 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -76,7 +76,7 @@ public:
static std::unique_ptr<PeerManager> make(CConnman& connman, AddrMan& addrman,
BanMan* banman, ChainstateManager& chainman,
CTxMemPool& pool, node::Warnings& warnings, Options opts);
- virtual ~PeerManager() { }
+ virtual ~PeerManager() = default;
/**
* Attempt to manually fetch block from a given peer. We must already have the header.
diff --git a/src/net_types.h b/src/net_types.h
index b9e019d8fd..21ef835b4e 100644
--- a/src/net_types.h
+++ b/src/net_types.h
@@ -19,7 +19,7 @@ public:
int64_t nCreateTime{0};
int64_t nBanUntil{0};
- CBanEntry() {}
+ CBanEntry() = default;
explicit CBanEntry(int64_t nCreateTimeIn)
: nCreateTime{nCreateTimeIn} {}
diff --git a/src/policy/fees.h b/src/policy/fees.h
index f34f66d3f0..a95cc19dd4 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -283,7 +283,7 @@ private:
{
unsigned int blockHeight{0};
unsigned int bucketIndex{0};
- TxStatsInfo() {}
+ TxStatsInfo() = default;
};
// map of txids to information about that transaction
diff --git a/src/prevector.h b/src/prevector.h
index 4776db789b..6dcc305268 100644
--- a/src/prevector.h
+++ b/src/prevector.h
@@ -242,7 +242,7 @@ public:
fill(item_ptr(0), first, last);
}
- prevector() {}
+ prevector() = default;
explicit prevector(size_type n) {
resize(n);
diff --git a/src/primitives/block.h b/src/primitives/block.h
index 832f8a03f7..207d2b2980 100644
--- a/src/primitives/block.h
+++ b/src/primitives/block.h
@@ -133,7 +133,7 @@ struct CBlockLocator
std::vector<uint256> vHave;
- CBlockLocator() {}
+ CBlockLocator() = default;
explicit CBlockLocator(std::vector<uint256>&& have) : vHave(std::move(have)) {}
diff --git a/src/psbt.h b/src/psbt.h
index 0663ca620c..6d49864b3c 100644
--- a/src/psbt.h
+++ b/src/psbt.h
@@ -225,7 +225,7 @@ struct PSBTInput
void FillSignatureData(SignatureData& sigdata) const;
void FromSignatureData(const SignatureData& sigdata);
void Merge(const PSBTInput& input);
- PSBTInput() {}
+ PSBTInput() = default;
template <typename Stream>
inline void Serialize(Stream& s) const {
@@ -726,7 +726,7 @@ struct PSBTOutput
void FillSignatureData(SignatureData& sigdata) const;
void FromSignatureData(const SignatureData& sigdata);
void Merge(const PSBTOutput& output);
- PSBTOutput() {}
+ PSBTOutput() = default;
template <typename Stream>
inline void Serialize(Stream& s) const {
@@ -967,7 +967,7 @@ struct PartiallySignedTransaction
[[nodiscard]] bool Merge(const PartiallySignedTransaction& psbt);
bool AddInput(const CTxIn& txin, PSBTInput& psbtin);
bool AddOutput(const CTxOut& txout, const PSBTOutput& psbtout);
- PartiallySignedTransaction() {}
+ PartiallySignedTransaction() = default;
explicit PartiallySignedTransaction(const CMutableTransaction& tx);
/**
* Finds the UTXO for a given input index
diff --git a/src/qt/transactiondesc.h b/src/qt/transactiondesc.h
index e64f2cace1..b92df67f41 100644
--- a/src/qt/transactiondesc.h
+++ b/src/qt/transactiondesc.h
@@ -29,7 +29,7 @@ public:
static QString toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord* rec, BitcoinUnit unit);
private:
- TransactionDesc() {}
+ TransactionDesc() = default;
static QString FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool);
};
diff --git a/src/rpc/server.h b/src/rpc/server.h
index 5735aff821..56e8a63088 100644
--- a/src/rpc/server.h
+++ b/src/rpc/server.h
@@ -48,7 +48,7 @@ bool RPCIsInWarmup(std::string *outStatus);
class RPCTimerBase
{
public:
- virtual ~RPCTimerBase() {}
+ virtual ~RPCTimerBase() = default;
};
/**
@@ -57,7 +57,7 @@ public:
class RPCTimerInterface
{
public:
- virtual ~RPCTimerInterface() {}
+ virtual ~RPCTimerInterface() = default;
/** Implementation name */
virtual const char *Name() = 0;
/** Factory function for timers.
diff --git a/src/script/interpreter.h b/src/script/interpreter.h
index 836c2e7982..8ba0018c23 100644
--- a/src/script/interpreter.h
+++ b/src/script/interpreter.h
@@ -265,7 +265,7 @@ public:
return false;
}
- virtual ~BaseSignatureChecker() {}
+ virtual ~BaseSignatureChecker() = default;
};
/** Enum to specify what *TransactionSignatureChecker's behavior should be
diff --git a/src/script/miniscript.h b/src/script/miniscript.h
index a269709e72..97912906d1 100644
--- a/src/script/miniscript.h
+++ b/src/script/miniscript.h
@@ -305,7 +305,7 @@ struct InputStack {
//! Data elements.
std::vector<std::vector<unsigned char>> stack;
//! Construct an empty stack (valid).
- InputStack() {}
+ InputStack() = default;
//! Construct a valid single-element stack (with an element up to 75 bytes).
InputStack(std::vector<unsigned char> in) : size(in.size() + 1), stack(Vector(std::move(in))) {}
//! Change availability
diff --git a/src/script/script.h b/src/script/script.h
index 66d63fae89..035152ee51 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -430,7 +430,7 @@ protected:
return *this;
}
public:
- CScript() { }
+ CScript() = default;
CScript(const_iterator pbegin, const_iterator pend) : CScriptBase(pbegin, pend) { }
CScript(std::vector<unsigned char>::const_iterator pbegin, std::vector<unsigned char>::const_iterator pend) : CScriptBase(pbegin, pend) { }
CScript(const unsigned char* pbegin, const unsigned char* pend) : CScriptBase(pbegin, pend) { }
@@ -569,7 +569,7 @@ struct CScriptWitness
std::vector<std::vector<unsigned char> > stack;
// Some compilers complain without a default constructor
- CScriptWitness() { }
+ CScriptWitness() = default;
bool IsNull() const { return stack.empty(); }
diff --git a/src/script/sign.h b/src/script/sign.h
index ace2ba7856..4edd5bf326 100644
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -27,7 +27,7 @@ struct CMutableTransaction;
/** Interface for signature creators. */
class BaseSignatureCreator {
public:
- virtual ~BaseSignatureCreator() {}
+ virtual ~BaseSignatureCreator() = default;
virtual const BaseSignatureChecker& Checker() const =0;
/** Create a singular (non-script) signature. */
@@ -89,7 +89,7 @@ struct SignatureData {
std::map<std::vector<uint8_t>, std::vector<uint8_t>> ripemd160_preimages; ///< Mapping from a RIPEMD160 hash to its preimage provided to solve a Script
std::map<std::vector<uint8_t>, std::vector<uint8_t>> hash160_preimages; ///< Mapping from a HASH160 hash to its preimage provided to solve a Script
- SignatureData() {}
+ SignatureData() = default;
explicit SignatureData(const CScript& script) : scriptSig(script) {}
void MergeSignatureData(SignatureData sigdata);
};
diff --git a/src/script/signingprovider.h b/src/script/signingprovider.h
index 3298376389..efdfd9ee56 100644
--- a/src/script/signingprovider.h
+++ b/src/script/signingprovider.h
@@ -150,7 +150,7 @@ std::optional<std::vector<std::tuple<int, std::vector<unsigned char>, int>>> Inf
class SigningProvider
{
public:
- virtual ~SigningProvider() {}
+ virtual ~SigningProvider() = default;
virtual bool GetCScript(const CScriptID &scriptid, CScript& script) const { return false; }
virtual bool HaveCScript(const CScriptID &scriptid) const { return false; }
virtual bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const { return false; }
diff --git a/src/serialize.h b/src/serialize.h
index 35519056a5..2af998f3c5 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -1061,7 +1061,7 @@ protected:
size_t nSize{0};
public:
- SizeComputer() {}
+ SizeComputer() = default;
void write(Span<const std::byte> src)
{
diff --git a/src/streams.h b/src/streams.h
index 57fc600646..c2a9dea287 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -161,7 +161,7 @@ public:
typedef vector_type::const_iterator const_iterator;
typedef vector_type::reverse_iterator reverse_iterator;
- explicit DataStream() {}
+ explicit DataStream() = default;
explicit DataStream(Span<const uint8_t> sp) : DataStream{AsBytes(sp)} {}
explicit DataStream(Span<const value_type> sp) : vch(sp.data(), sp.data() + sp.size()) {}
diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp
index fe3ba38cde..01eef2b93d 100644
--- a/src/support/lockedpool.cpp
+++ b/src/support/lockedpool.cpp
@@ -46,9 +46,7 @@ Arena::Arena(void *base_in, size_t size_in, size_t alignment_in):
chunks_free_end.emplace(static_cast<char*>(base) + size_in, it);
}
-Arena::~Arena()
-{
-}
+Arena::~Arena() = default;
void* Arena::alloc(size_t size)
{
diff --git a/src/support/lockedpool.h b/src/support/lockedpool.h
index 81e0df513a..2363b1e4ef 100644
--- a/src/support/lockedpool.h
+++ b/src/support/lockedpool.h
@@ -19,7 +19,7 @@
class LockedPageAllocator
{
public:
- virtual ~LockedPageAllocator() {}
+ virtual ~LockedPageAllocator() = default;
/** Allocate and lock memory pages.
* If len is not a multiple of the system page size, it is rounded up.
* Returns nullptr in case of allocation failure.
diff --git a/src/sync.h b/src/sync.h
index dc63e3f2d0..b22956ef1a 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -206,7 +206,7 @@ public:
protected:
// needed for reverse_lock
- UniqueLock() { }
+ UniqueLock() = default;
public:
/**
diff --git a/src/threadsafety.h b/src/threadsafety.h
index 28b6177927..2e9a39bfc9 100644
--- a/src/threadsafety.h
+++ b/src/threadsafety.h
@@ -71,7 +71,7 @@ class SCOPED_LOCKABLE StdLockGuard : public std::lock_guard<StdMutex>
{
public:
explicit StdLockGuard(StdMutex& cs) EXCLUSIVE_LOCK_FUNCTION(cs) : std::lock_guard<StdMutex>(cs) {}
- ~StdLockGuard() UNLOCK_FUNCTION() {}
+ ~StdLockGuard() UNLOCK_FUNCTION() = default;
};
#endif // BITCOIN_THREADSAFETY_H
diff --git a/src/tinyformat.h b/src/tinyformat.h
index 3ec385bc95..f536306375 100644
--- a/src/tinyformat.h
+++ b/src/tinyformat.h
@@ -507,8 +507,7 @@ namespace detail {
class FormatArg
{
public:
- FormatArg()
- { }
+ FormatArg() = default;
template<typename T>
explicit FormatArg(const T& value)
diff --git a/src/util/subprocess.h b/src/util/subprocess.h
index e76ced687c..3449fa3b1b 100644
--- a/src/util/subprocess.h
+++ b/src/util/subprocess.h
@@ -678,7 +678,7 @@ struct error
class Buffer
{
public:
- Buffer() {}
+ Buffer() = default;
explicit Buffer(size_t cap) { buf.resize(cap); }
void add_cap(size_t cap) { buf.resize(cap); }
diff --git a/src/util/task_runner.h b/src/util/task_runner.h
index d3cd8007de..951381823b 100644
--- a/src/util/task_runner.h
+++ b/src/util/task_runner.h
@@ -19,7 +19,7 @@ namespace util {
class TaskRunnerInterface
{
public:
- virtual ~TaskRunnerInterface() {}
+ virtual ~TaskRunnerInterface() = default;
/**
* The callback can either be queued for later/asynchronous/threaded
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
index 813fde109c..579444a065 100644
--- a/src/validationinterface.cpp
+++ b/src/validationinterface.cpp
@@ -95,7 +95,7 @@ public:
ValidationSignals::ValidationSignals(std::unique_ptr<util::TaskRunnerInterface> task_runner)
: m_internals{std::make_unique<ValidationSignalsImpl>(std::move(task_runner))} {}
-ValidationSignals::~ValidationSignals() {}
+ValidationSignals::~ValidationSignals() = default;
void ValidationSignals::FlushBackgroundCallbacks()
{
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h
index 9fb000422c..416273be7a 100644
--- a/src/wallet/coinselection.h
+++ b/src/wallet/coinselection.h
@@ -255,7 +255,7 @@ struct OutputGroup
/** Total weight of the UTXOs in this group. */
int m_weight{0};
- OutputGroup() {}
+ OutputGroup() = default;
OutputGroup(const CoinSelectionParams& params) :
m_long_term_feerate(params.m_long_term_feerate),
m_subtract_fee_outputs(params.m_subtract_fee_outputs)
diff --git a/src/wallet/db.h b/src/wallet/db.h
index b45076d10c..2045d51376 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -30,8 +30,8 @@ bool operator<(Span<const std::byte> a, BytePrefix b);
class DatabaseCursor
{
public:
- explicit DatabaseCursor() {}
- virtual ~DatabaseCursor() {}
+ explicit DatabaseCursor() = default;
+ virtual ~DatabaseCursor() = default;
DatabaseCursor(const DatabaseCursor&) = delete;
DatabaseCursor& operator=(const DatabaseCursor&) = delete;
@@ -56,8 +56,8 @@ private:
virtual bool HasKey(DataStream&& key) = 0;
public:
- explicit DatabaseBatch() {}
- virtual ~DatabaseBatch() {}
+ explicit DatabaseBatch() = default;
+ virtual ~DatabaseBatch() = default;
DatabaseBatch(const DatabaseBatch&) = delete;
DatabaseBatch& operator=(const DatabaseBatch&) = delete;
@@ -131,7 +131,7 @@ class WalletDatabase
public:
/** Create dummy DB handle */
WalletDatabase() : nUpdateCounter(0) {}
- virtual ~WalletDatabase() {};
+ virtual ~WalletDatabase() = default;
/** Open the database if it is not already opened. */
virtual void Open() = 0;
diff --git a/src/wallet/migrate.h b/src/wallet/migrate.h
index e4826450af..58c8c0adf4 100644
--- a/src/wallet/migrate.h
+++ b/src/wallet/migrate.h
@@ -28,7 +28,7 @@ public:
{
if (open) Open();
}
- ~BerkeleyRODatabase(){};
+ ~BerkeleyRODatabase() = default;
BerkeleyROData m_records;
@@ -81,7 +81,7 @@ private:
public:
explicit BerkeleyROCursor(const BerkeleyRODatabase& database, Span<const std::byte> prefix = {});
- ~BerkeleyROCursor() {}
+ ~BerkeleyROCursor() = default;
Status Next(DataStream& key, DataStream& value) override;
};
@@ -102,7 +102,7 @@ private:
public:
explicit BerkeleyROBatch(const BerkeleyRODatabase& database) : m_database(database) {}
- ~BerkeleyROBatch() {}
+ ~BerkeleyROBatch() = default;
BerkeleyROBatch(const BerkeleyROBatch&) = delete;
BerkeleyROBatch& operator=(const BerkeleyROBatch&) = delete;
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index bb0294b22e..6659cbf52b 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -178,7 +178,7 @@ protected:
public:
explicit ScriptPubKeyMan(WalletStorage& storage) : m_storage(storage) {}
- virtual ~ScriptPubKeyMan() {};
+ virtual ~ScriptPubKeyMan() = default;
virtual util::Result<CTxDestination> GetNewDestination(const OutputType type) { return util::Error{Untranslated("Not supported")}; }
virtual isminetype IsMine(const CScript& script) const { return ISMINE_NO; }
diff --git a/src/wallet/sqlite.h b/src/wallet/sqlite.h
index 0a3243fe19..6b84f34366 100644
--- a/src/wallet/sqlite.h
+++ b/src/wallet/sqlite.h
@@ -26,7 +26,7 @@ public:
std::vector<std::byte> m_prefix_range_start;
std::vector<std::byte> m_prefix_range_end;
- explicit SQLiteCursor() {}
+ explicit SQLiteCursor() = default;
explicit SQLiteCursor(std::vector<std::byte> start_range, std::vector<std::byte> end_range)
: m_prefix_range_start(std::move(start_range)),
m_prefix_range_end(std::move(end_range))
@@ -41,7 +41,7 @@ public:
class SQliteExecHandler
{
public:
- virtual ~SQliteExecHandler() {}
+ virtual ~SQliteExecHandler() = default;
virtual int Exec(SQLiteDatabase& database, const std::string& statement);
};
diff --git a/src/wallet/test/util.h b/src/wallet/test/util.h
index a3e6ede81e..fc7674e961 100644
--- a/src/wallet/test/util.h
+++ b/src/wallet/test/util.h
@@ -61,7 +61,7 @@ public:
explicit MockableCursor(const MockableData& records, bool pass) : m_cursor(records.begin()), m_cursor_end(records.end()), m_pass(pass) {}
MockableCursor(const MockableData& records, bool pass, Span<const std::byte> prefix);
- ~MockableCursor() {}
+ ~MockableCursor() = default;
Status Next(DataStream& key, DataStream& value) override;
};
@@ -80,7 +80,7 @@ private:
public:
explicit MockableBatch(MockableData& records, bool pass) : m_records(records), m_pass(pass) {}
- ~MockableBatch() {}
+ ~MockableBatch() = default;
void Flush() override {}
void Close() override {}
@@ -106,7 +106,7 @@ public:
bool m_pass{true};
MockableDatabase(MockableData records = {}) : WalletDatabase(), m_records(records) {}
- ~MockableDatabase() {};
+ ~MockableDatabase() = default;
void Open() override {}
void AddRef() override {}
diff --git a/src/wallet/walletutil.h b/src/wallet/walletutil.h
index 38926c1eb8..96cb35b926 100644
--- a/src/wallet/walletutil.h
+++ b/src/wallet/walletutil.h
@@ -111,7 +111,7 @@ public:
SER_READ(obj, obj.DeserializeDescriptor(descriptor_str));
}
- WalletDescriptor() {}
+ WalletDescriptor() = default;
WalletDescriptor(std::shared_ptr<Descriptor> descriptor, uint64_t creation_time, int32_t range_start, int32_t range_end, int32_t next_index) : descriptor(descriptor), id(DescriptorID(*descriptor)), creation_time(creation_time), range_start(range_start), range_end(range_end), next_index(next_index) { }
};
diff --git a/src/walletinitinterface.h b/src/walletinitinterface.h
index ce8b6cfd6e..ecee2e93a9 100644
--- a/src/walletinitinterface.h
+++ b/src/walletinitinterface.h
@@ -22,7 +22,7 @@ public:
/** Add wallets that should be opened to list of chain clients. */
virtual void Construct(node::NodeContext& node) const = 0;
- virtual ~WalletInitInterface() {}
+ virtual ~WalletInitInterface() = default;
};
extern const WalletInitInterface& g_wallet_init_interface;
diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp
index 536e471053..44cbacda64 100644
--- a/src/zmq/zmqnotificationinterface.cpp
+++ b/src/zmq/zmqnotificationinterface.cpp
@@ -24,9 +24,7 @@
#include <utility>
#include <vector>
-CZMQNotificationInterface::CZMQNotificationInterface()
-{
-}
+CZMQNotificationInterface::CZMQNotificationInterface() = default;
CZMQNotificationInterface::~CZMQNotificationInterface()
{