Skip to content

Commit 3333bae

Browse files
author
MarcoFalke
committed
tidy: modernize-use-equals-default
1 parent bd5d168 commit 3333bae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+72
-76
lines changed

src/.clang-tidy

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ misc-unused-using-decls,
1010
misc-no-recursion,
1111
modernize-use-default-member-init,
1212
modernize-use-emplace,
13+
modernize-use-equals-default,
1314
modernize-use-noexcept,
1415
modernize-use-nullptr,
1516
performance-*,

src/arith_uint256.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class base_uint
240240
/** 256-bit unsigned big integer. */
241241
class arith_uint256 : public base_uint<256> {
242242
public:
243-
arith_uint256() {}
243+
arith_uint256() = default;
244244
arith_uint256(const base_uint<256>& b) : base_uint<256>(b) {}
245245
arith_uint256(uint64_t b) : base_uint<256>(b) {}
246246

src/blockencodings.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class BlockTransactions {
5959
uint256 blockhash;
6060
std::vector<CTransactionRef> txn;
6161

62-
BlockTransactions() {}
62+
BlockTransactions() = default;
6363
explicit BlockTransactions(const BlockTransactionsRequest& req) :
6464
blockhash(req.blockhash), txn(req.indexes.size()) {}
6565

@@ -109,7 +109,7 @@ class CBlockHeaderAndShortTxIDs {
109109
/**
110110
* Dummy for deserialization
111111
*/
112-
CBlockHeaderAndShortTxIDs() {}
112+
CBlockHeaderAndShortTxIDs() = default;
113113

114114
/**
115115
* @param[in] nonce This should be randomly generated, and is used for the siphash secret key

src/chain.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CBlockFileInfo
6666
READWRITE(VARINT(obj.nTimeLast));
6767
}
6868

69-
CBlockFileInfo() {}
69+
CBlockFileInfo() = default;
7070

7171
std::string ToString() const;
7272

src/coins.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class CCoinsViewCursor
154154
{
155155
public:
156156
CCoinsViewCursor(const uint256 &hashBlockIn): hashBlock(hashBlockIn) {}
157-
virtual ~CCoinsViewCursor() {}
157+
virtual ~CCoinsViewCursor() = default;
158158

159159
virtual bool GetKey(COutPoint &key) const = 0;
160160
virtual bool GetValue(Coin &coin) const = 0;
@@ -198,7 +198,7 @@ class CCoinsView
198198
virtual std::unique_ptr<CCoinsViewCursor> Cursor() const;
199199

200200
//! As we use CCoinsViews polymorphically, have a virtual destructor
201-
virtual ~CCoinsView() {}
201+
virtual ~CCoinsView() = default;
202202

203203
//! Estimate database size (0 if not implemented)
204204
virtual size_t EstimateSize() const { return 0; }

src/crypto/muhash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class MuHash3072
9797

9898
public:
9999
/* The empty set. */
100-
MuHash3072() noexcept {};
100+
MuHash3072() noexcept = default;
101101

102102
/* A singleton with variable sized data in it. */
103103
explicit MuHash3072(Span<const unsigned char> in) noexcept;

src/crypto/sha3.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SHA3_256
3232
public:
3333
static constexpr size_t OUTPUT_SIZE = 32;
3434

35-
SHA3_256() {}
35+
SHA3_256() = default;
3636
SHA3_256& Write(Span<const unsigned char> data);
3737
SHA3_256& Finalize(Span<unsigned char> output);
3838
SHA3_256& Reset();

src/flatfile.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct FlatFilePos
1818

1919
SERIALIZE_METHODS(FlatFilePos, obj) { READWRITE(VARINT_MODE(obj.nFile, VarIntMode::NONNEGATIVE_SIGNED), VARINT(obj.nPos)); }
2020

21-
FlatFilePos() {}
21+
FlatFilePos() = default;
2222

2323
FlatFilePos(int nFileIn, unsigned int nPosIn) :
2424
nFile(nFileIn),

src/headerssync.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct CompressedHeader {
100100

101101
class HeadersSyncState {
102102
public:
103-
~HeadersSyncState() {}
103+
~HeadersSyncState() = default;
104104

105105
enum class State {
106106
/** PRESYNC means the peer has not yet demonstrated their chain has

src/httpserver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class HTTPClosure
156156
{
157157
public:
158158
virtual void operator()() = 0;
159-
virtual ~HTTPClosure() {}
159+
virtual ~HTTPClosure() = default;
160160
};
161161

162162
/** Event class. This can be used either as a cross-thread trigger or as a timer.

src/index/disktxpos.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct CDiskTxPos : public FlatFilePos
2020
CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
2121
}
2222

23-
CDiskTxPos() {}
23+
CDiskTxPos() = default;
2424
};
2525

2626
#endif // BITCOIN_INDEX_DISKTXPOS_H

src/interfaces/chain.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct BlockInfo {
123123
class Chain
124124
{
125125
public:
126-
virtual ~Chain() {}
126+
virtual ~Chain() = default;
127127

128128
//! Get current chain height, not including genesis block (returns 0 if
129129
//! chain only contains genesis block, nullopt if chain does not contain
@@ -309,7 +309,7 @@ class Chain
309309
class Notifications
310310
{
311311
public:
312-
virtual ~Notifications() {}
312+
virtual ~Notifications() = default;
313313
virtual void transactionAddedToMempool(const CTransactionRef& tx) {}
314314
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) {}
315315
virtual void blockConnected(ChainstateRole role, const BlockInfo& block) {}
@@ -371,7 +371,7 @@ class Chain
371371
class ChainClient
372372
{
373373
public:
374-
virtual ~ChainClient() {}
374+
virtual ~ChainClient() = default;
375375

376376
//! Register rpcs.
377377
virtual void registerRpcs() = 0;

src/interfaces/echo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace interfaces {
1313
class Echo
1414
{
1515
public:
16-
virtual ~Echo() {}
16+
virtual ~Echo() = default;
1717

1818
//! Echo provided string.
1919
virtual std::string echo(const std::string& echo) = 0;

src/interfaces/handler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace interfaces {
2222
class Handler
2323
{
2424
public:
25-
virtual ~Handler() {}
25+
virtual ~Handler() = default;
2626

2727
//! Disconnect the handler.
2828
virtual void disconnect() = 0;

src/interfaces/mining.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace interfaces {
2626
class Mining
2727
{
2828
public:
29-
virtual ~Mining() {}
29+
virtual ~Mining() = default;
3030

3131
//! If this chain is exclusively used for testing
3232
virtual bool isTestChain() = 0;

src/interfaces/node.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct BlockAndHeaderTipInfo
5959
class ExternalSigner
6060
{
6161
public:
62-
virtual ~ExternalSigner() {};
62+
virtual ~ExternalSigner() = default;
6363

6464
//! Get signer display name
6565
virtual std::string getName() = 0;
@@ -69,7 +69,7 @@ class ExternalSigner
6969
class Node
7070
{
7171
public:
72-
virtual ~Node() {}
72+
virtual ~Node() = default;
7373

7474
//! Init logging.
7575
virtual void initLogging() = 0;

src/interfaces/wallet.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ using WalletValueMap = std::map<std::string, std::string>;
6565
class Wallet
6666
{
6767
public:
68-
virtual ~Wallet() {}
68+
virtual ~Wallet() = default;
6969

7070
//! Encrypt wallet.
7171
virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0;

src/kernel/chainparams.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class CChainParams
163163
static std::unique_ptr<const CChainParams> TestNet();
164164

165165
protected:
166-
CChainParams() {}
166+
CChainParams() = default;
167167

168168
Consensus::Params consensus;
169169
MessageStartChars pchMessageStart;

src/kernel/notifications_interface.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bool IsInterrupted(const T& result)
3535
class Notifications
3636
{
3737
public:
38-
virtual ~Notifications(){};
38+
virtual ~Notifications() = default;
3939

4040
[[nodiscard]] virtual InterruptResult blockTip(SynchronizationState state, CBlockIndex& index) { return {}; }
4141
virtual void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) {}

src/merkleblock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class CMerkleBlock
147147
// Create from a CBlock, matching the txids in the set
148148
CMerkleBlock(const CBlock& block, const std::set<Txid>& txids) : CMerkleBlock{block, nullptr, &txids} {}
149149

150-
CMerkleBlock() {}
150+
CMerkleBlock() = default;
151151

152152
SERIALIZE_METHODS(CMerkleBlock, obj) { READWRITE(obj.header, obj.txn); }
153153

src/net.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class CNetMessage
250250
/** The Transport converts one connection's sent messages to wire bytes, and received bytes back. */
251251
class Transport {
252252
public:
253-
virtual ~Transport() {}
253+
virtual ~Transport() = default;
254254

255255
struct Info
256256
{

src/net_processing.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
7676
static std::unique_ptr<PeerManager> make(CConnman& connman, AddrMan& addrman,
7777
BanMan* banman, ChainstateManager& chainman,
7878
CTxMemPool& pool, node::Warnings& warnings, Options opts);
79-
virtual ~PeerManager() { }
79+
virtual ~PeerManager() = default;
8080

8181
/**
8282
* Attempt to manually fetch block from a given peer. We must already have the header.

src/net_types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CBanEntry
1919
int64_t nCreateTime{0};
2020
int64_t nBanUntil{0};
2121

22-
CBanEntry() {}
22+
CBanEntry() = default;
2323

2424
explicit CBanEntry(int64_t nCreateTimeIn)
2525
: nCreateTime{nCreateTimeIn} {}

src/policy/fees.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class CBlockPolicyEstimator : public CValidationInterface
283283
{
284284
unsigned int blockHeight{0};
285285
unsigned int bucketIndex{0};
286-
TxStatsInfo() {}
286+
TxStatsInfo() = default;
287287
};
288288

289289
// map of txids to information about that transaction

src/prevector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class prevector {
242242
fill(item_ptr(0), first, last);
243243
}
244244

245-
prevector() {}
245+
prevector() = default;
246246

247247
explicit prevector(size_type n) {
248248
resize(n);

src/primitives/block.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ struct CBlockLocator
133133

134134
std::vector<uint256> vHave;
135135

136-
CBlockLocator() {}
136+
CBlockLocator() = default;
137137

138138
explicit CBlockLocator(std::vector<uint256>&& have) : vHave(std::move(have)) {}
139139

src/psbt.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct PSBTInput
225225
void FillSignatureData(SignatureData& sigdata) const;
226226
void FromSignatureData(const SignatureData& sigdata);
227227
void Merge(const PSBTInput& input);
228-
PSBTInput() {}
228+
PSBTInput() = default;
229229

230230
template <typename Stream>
231231
inline void Serialize(Stream& s) const {
@@ -726,7 +726,7 @@ struct PSBTOutput
726726
void FillSignatureData(SignatureData& sigdata) const;
727727
void FromSignatureData(const SignatureData& sigdata);
728728
void Merge(const PSBTOutput& output);
729-
PSBTOutput() {}
729+
PSBTOutput() = default;
730730

731731
template <typename Stream>
732732
inline void Serialize(Stream& s) const {
@@ -967,7 +967,7 @@ struct PartiallySignedTransaction
967967
[[nodiscard]] bool Merge(const PartiallySignedTransaction& psbt);
968968
bool AddInput(const CTxIn& txin, PSBTInput& psbtin);
969969
bool AddOutput(const CTxOut& txout, const PSBTOutput& psbtout);
970-
PartiallySignedTransaction() {}
970+
PartiallySignedTransaction() = default;
971971
explicit PartiallySignedTransaction(const CMutableTransaction& tx);
972972
/**
973973
* Finds the UTXO for a given input index

src/qt/transactiondesc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TransactionDesc: public QObject
2929
static QString toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord* rec, BitcoinUnit unit);
3030

3131
private:
32-
TransactionDesc() {}
32+
TransactionDesc() = default;
3333

3434
static QString FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool);
3535
};

src/rpc/server.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bool RPCIsInWarmup(std::string *outStatus);
4848
class RPCTimerBase
4949
{
5050
public:
51-
virtual ~RPCTimerBase() {}
51+
virtual ~RPCTimerBase() = default;
5252
};
5353

5454
/**
@@ -57,7 +57,7 @@ class RPCTimerBase
5757
class RPCTimerInterface
5858
{
5959
public:
60-
virtual ~RPCTimerInterface() {}
60+
virtual ~RPCTimerInterface() = default;
6161
/** Implementation name */
6262
virtual const char *Name() = 0;
6363
/** Factory function for timers.

src/script/interpreter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class BaseSignatureChecker
265265
return false;
266266
}
267267

268-
virtual ~BaseSignatureChecker() {}
268+
virtual ~BaseSignatureChecker() = default;
269269
};
270270

271271
/** Enum to specify what *TransactionSignatureChecker's behavior should be

src/script/miniscript.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ struct InputStack {
305305
//! Data elements.
306306
std::vector<std::vector<unsigned char>> stack;
307307
//! Construct an empty stack (valid).
308-
InputStack() {}
308+
InputStack() = default;
309309
//! Construct a valid single-element stack (with an element up to 75 bytes).
310310
InputStack(std::vector<unsigned char> in) : size(in.size() + 1), stack(Vector(std::move(in))) {}
311311
//! Change availability

src/script/script.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class CScript : public CScriptBase
430430
return *this;
431431
}
432432
public:
433-
CScript() { }
433+
CScript() = default;
434434
CScript(const_iterator pbegin, const_iterator pend) : CScriptBase(pbegin, pend) { }
435435
CScript(std::vector<unsigned char>::const_iterator pbegin, std::vector<unsigned char>::const_iterator pend) : CScriptBase(pbegin, pend) { }
436436
CScript(const unsigned char* pbegin, const unsigned char* pend) : CScriptBase(pbegin, pend) { }
@@ -569,7 +569,7 @@ struct CScriptWitness
569569
std::vector<std::vector<unsigned char> > stack;
570570

571571
// Some compilers complain without a default constructor
572-
CScriptWitness() { }
572+
CScriptWitness() = default;
573573

574574
bool IsNull() const { return stack.empty(); }
575575

src/script/sign.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct CMutableTransaction;
2727
/** Interface for signature creators. */
2828
class BaseSignatureCreator {
2929
public:
30-
virtual ~BaseSignatureCreator() {}
30+
virtual ~BaseSignatureCreator() = default;
3131
virtual const BaseSignatureChecker& Checker() const =0;
3232

3333
/** Create a singular (non-script) signature. */
@@ -89,7 +89,7 @@ struct SignatureData {
8989
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
9090
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
9191

92-
SignatureData() {}
92+
SignatureData() = default;
9393
explicit SignatureData(const CScript& script) : scriptSig(script) {}
9494
void MergeSignatureData(SignatureData sigdata);
9595
};

src/script/signingprovider.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ std::optional<std::vector<std::tuple<int, std::vector<unsigned char>, int>>> Inf
150150
class SigningProvider
151151
{
152152
public:
153-
virtual ~SigningProvider() {}
153+
virtual ~SigningProvider() = default;
154154
virtual bool GetCScript(const CScriptID &scriptid, CScript& script) const { return false; }
155155
virtual bool HaveCScript(const CScriptID &scriptid) const { return false; }
156156
virtual bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const { return false; }

0 commit comments

Comments
 (0)