Skip to content

Commit 9a941a1

Browse files
committed
Merge #10631: Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class
aa95947 Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class (practicalswift) Tree-SHA512: 3835e9b4ceaa4b2db485a25dfa3e5fe50c2e3ecb22ca9d5331aed7728aa496d4378fb84c0a1a3c47b0adecc10a00bca99cc239cbaf94cf2ce5b4cda497db6023
2 parents a381f6a + aa95947 commit 9a941a1

18 files changed

+68
-68
lines changed

src/httprpc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ class HTTPRPCTimerInterface : public RPCTimerInterface
4747
HTTPRPCTimerInterface(struct event_base* _base) : base(_base)
4848
{
4949
}
50-
const char* Name()
50+
const char* Name() override
5151
{
5252
return "HTTP";
5353
}
54-
RPCTimerBase* NewTimer(std::function<void(void)>& func, int64_t millis)
54+
RPCTimerBase* NewTimer(std::function<void(void)>& func, int64_t millis) override
5555
{
5656
return new HTTPRPCTimer(base, func, millis);
5757
}

src/httpserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class HTTPWorkItem : public HTTPClosure
4646
req(std::move(_req)), path(_path), func(_func)
4747
{
4848
}
49-
void operator()()
49+
void operator()() override
5050
{
5151
func(req.get(), path);
5252
}

src/keystore.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ class CBasicKeyStore : public CKeyStore
6060
WatchOnlySet setWatchOnly;
6161

6262
public:
63-
bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
64-
bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
65-
bool HaveKey(const CKeyID &address) const
63+
bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey) override;
64+
bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override;
65+
bool HaveKey(const CKeyID &address) const override
6666
{
6767
bool result;
6868
{
@@ -71,7 +71,7 @@ class CBasicKeyStore : public CKeyStore
7171
}
7272
return result;
7373
}
74-
void GetKeys(std::set<CKeyID> &setAddress) const
74+
void GetKeys(std::set<CKeyID> &setAddress) const override
7575
{
7676
setAddress.clear();
7777
{
@@ -84,7 +84,7 @@ class CBasicKeyStore : public CKeyStore
8484
}
8585
}
8686
}
87-
bool GetKey(const CKeyID &address, CKey &keyOut) const
87+
bool GetKey(const CKeyID &address, CKey &keyOut) const override
8888
{
8989
{
9090
LOCK(cs_KeyStore);
@@ -97,14 +97,14 @@ class CBasicKeyStore : public CKeyStore
9797
}
9898
return false;
9999
}
100-
virtual bool AddCScript(const CScript& redeemScript);
101-
virtual bool HaveCScript(const CScriptID &hash) const;
102-
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const;
100+
virtual bool AddCScript(const CScript& redeemScript) override;
101+
virtual bool HaveCScript(const CScriptID &hash) const override;
102+
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override;
103103

104-
virtual bool AddWatchOnly(const CScript &dest);
105-
virtual bool RemoveWatchOnly(const CScript &dest);
106-
virtual bool HaveWatchOnly(const CScript &dest) const;
107-
virtual bool HaveWatchOnly() const;
104+
virtual bool AddWatchOnly(const CScript &dest) override;
105+
virtual bool RemoveWatchOnly(const CScript &dest) override;
106+
virtual bool HaveWatchOnly(const CScript &dest) const override;
107+
virtual bool HaveWatchOnly() const override;
108108
};
109109

110110
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;

src/script/interpreter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ class TransactionSignatureChecker : public BaseSignatureChecker
160160
public:
161161
TransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn) : txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(NULL) {}
162162
TransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, const PrecomputedTransactionData& txdataIn) : txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(&txdataIn) {}
163-
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const;
164-
bool CheckLockTime(const CScriptNum& nLockTime) const;
165-
bool CheckSequence(const CScriptNum& nSequence) const;
163+
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override;
164+
bool CheckLockTime(const CScriptNum& nLockTime) const override;
165+
bool CheckSequence(const CScriptNum& nSequence) const override;
166166
};
167167

168168
class MutableTransactionSignatureChecker : public TransactionSignatureChecker

src/script/sigcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CachingTransactionSignatureChecker : public TransactionSignatureChecker
4848
public:
4949
CachingTransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, bool storeIn, PrecomputedTransactionData& txdataIn) : TransactionSignatureChecker(txToIn, nInIn, amountIn, txdataIn), store(storeIn) {}
5050

51-
bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const;
51+
bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const override;
5252
};
5353

5454
void InitSignatureCache();

src/script/sign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class DummySignatureChecker : public BaseSignatureChecker
393393
public:
394394
DummySignatureChecker() {}
395395

396-
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const
396+
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override
397397
{
398398
return true;
399399
}

src/script/sign.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class TransactionSignatureCreator : public BaseSignatureCreator {
4040

4141
public:
4242
TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn=SIGHASH_ALL);
43-
const BaseSignatureChecker& Checker() const { return checker; }
44-
bool CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const;
43+
const BaseSignatureChecker& Checker() const override { return checker; }
44+
bool CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override;
4545
};
4646

4747
class MutableTransactionSignatureCreator : public TransactionSignatureCreator {
@@ -55,8 +55,8 @@ class MutableTransactionSignatureCreator : public TransactionSignatureCreator {
5555
class DummySignatureCreator : public BaseSignatureCreator {
5656
public:
5757
DummySignatureCreator(const CKeyStore* keystoreIn) : BaseSignatureCreator(keystoreIn) {}
58-
const BaseSignatureChecker& Checker() const;
59-
bool CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const;
58+
const BaseSignatureChecker& Checker() const override;
59+
bool CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override;
6060
};
6161

6262
struct SignatureData {

src/support/lockedpool.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ class Win32LockedPageAllocator: public LockedPageAllocator
148148
{
149149
public:
150150
Win32LockedPageAllocator();
151-
void* AllocateLocked(size_t len, bool *lockingSuccess);
152-
void FreeLocked(void* addr, size_t len);
153-
size_t GetLimit();
151+
void* AllocateLocked(size_t len, bool *lockingSuccess) override;
152+
void FreeLocked(void* addr, size_t len) override;
153+
size_t GetLimit() override;
154154
private:
155155
size_t page_size;
156156
};
@@ -200,9 +200,9 @@ class PosixLockedPageAllocator: public LockedPageAllocator
200200
{
201201
public:
202202
PosixLockedPageAllocator();
203-
void* AllocateLocked(size_t len, bool *lockingSuccess);
204-
void FreeLocked(void* addr, size_t len);
205-
size_t GetLimit();
203+
void* AllocateLocked(size_t len, bool *lockingSuccess) override;
204+
void FreeLocked(void* addr, size_t len) override;
205+
size_t GetLimit() override;
206206
private:
207207
size_t page_size;
208208
};

src/test/addrman_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CAddrManTest : public CAddrMan
2727
insecure_rand = FastRandomContext(true);
2828
}
2929

30-
int RandomInt(int nMax)
30+
int RandomInt(int nMax) override
3131
{
3232
state = (CHashWriter(SER_GETHASH, 0) << state).GetHash().GetCheapHash();
3333
return (unsigned int)(state % nMax);

src/test/allocator_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class TestLockedPageAllocator: public LockedPageAllocator
131131
{
132132
public:
133133
TestLockedPageAllocator(int count_in, int lockedcount_in): count(count_in), lockedcount(lockedcount_in) {}
134-
void* AllocateLocked(size_t len, bool *lockingSuccess)
134+
void* AllocateLocked(size_t len, bool *lockingSuccess) override
135135
{
136136
*lockingSuccess = false;
137137
if (count > 0) {
@@ -146,10 +146,10 @@ class TestLockedPageAllocator: public LockedPageAllocator
146146
}
147147
return 0;
148148
}
149-
void FreeLocked(void* addr, size_t len)
149+
void FreeLocked(void* addr, size_t len) override
150150
{
151151
}
152-
size_t GetLimit()
152+
size_t GetLimit() override
153153
{
154154
return std::numeric_limits<size_t>::max();
155155
}

0 commit comments

Comments
 (0)