Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port multiple master-targeted fixes to janus release branch #56

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4287126
correct python3 comparison operator
slowriot Aug 19, 2021
82be88a
enable building tests by default, external signer default to match bi…
slowriot Aug 20, 2021
dc7c5ae
reinstate valid base58 test data and test methodology from bitcoin core
slowriot Sep 1, 2021
5bcd84e
declare classes final where appropriate, to enable devirtualisation o…
slowriot Aug 20, 2021
d9d0c9a
add warning to suggest attribute noreturn if applicable
slowriot Sep 1, 2021
cadbc14
add warning to suggest attribute const and placeholder warning for at…
slowriot Aug 21, 2021
7413615
add single warning for "unused" warning options
slowriot Aug 21, 2021
bcc5729
add attribute [[maybe_unused]] to mark parameters that are known not …
slowriot Aug 21, 2021
74e3558
remove unused debugging includes
slowriot Aug 20, 2021
602e578
use C++17 fallthrough attributes instead of comments, resolve fallthr…
slowriot Aug 20, 2021
53702ef
add modern fallthrough attribute, replace old hacky solutions
slowriot Aug 20, 2021
1153e5f
tidy and remove unneeded braces for cases that don't require them
slowriot Aug 20, 2021
bb7b45a
add warning for non-virtual destructor in base class, and fix all ins…
slowriot Aug 20, 2021
b302246
add extra performance and safety compiler warnings
slowriot Aug 20, 2021
8fc8b6e
add warning for implicit double promotion
slowriot Aug 20, 2021
fe178e9
avoid unnecessary double promotion in calculating time interval, and …
slowriot Aug 20, 2021
e5e2f10
avoid implicit conversions that may alter a value, or make them expli…
slowriot Aug 20, 2021
641b656
placeholder warnings for conversion and useless casts
slowriot Aug 24, 2021
2e9f261
do not enable DEBUG_LOCKORDER for all debug builds; the code associat…
slowriot Aug 24, 2021
e82c875
remove unused includes
slowriot Aug 25, 2021
06c8771
don't disable implicit-fallthrough warning (this is now dealt with in…
slowriot Aug 24, 2021
fbc5630
re-enable asserts for signet chain params at creation, with correct g…
slowriot Aug 25, 2021
47d9edd
remove unused include
slowriot Aug 25, 2021
333e731
add tests to verify test addresses are valid - this also tests the va…
slowriot Aug 25, 2021
24b4b53
add a test to ensure a BTC address does not count as a valid destination
slowriot Aug 25, 2021
f97a386
enable building tests by default, external signer default to match bi…
slowriot Aug 20, 2021
0743fd2
don't disable implicit-fallthrough warning (this is now dealt with in…
slowriot Aug 24, 2021
5dd71f1
update benchmark decode address to BGL prefix for consistency
slowriot Aug 25, 2021
242d656
update test data sample BTC address to BGL format with prefix 10
slowriot Aug 25, 2021
0d0d37b
some tests use the pubkey of the BTC genesis block - update these to …
slowriot Aug 25, 2021
c6bb29c
Revert "don't disable implicit-fallthrough warning (this is now dealt…
slowriot Sep 1, 2021
53de81b
remove attribute final from classes Sock, CCoinsViewCache, Descriptor…
slowriot Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ AC_ARG_ENABLE([natpmp-default],
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--disable-tests],[do not compile tests (default is to compile)]),
[use_tests=$enableval],
[use_tests=no])
[use_tests=yes])

AC_ARG_ENABLE(gui-tests,
AS_HELP_STRING([--disable-gui-tests],[do not compile GUI tests (default is to compile if GUI and tests enabled)]),
Expand Down Expand Up @@ -343,7 +343,7 @@ AC_ARG_ENABLE([werror],
AC_ARG_ENABLE([external-signer],
[AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is no, requires Boost::Process)])],
[use_external_signer=$enableval],
[use_external_signer=no])
[use_external_signer=yes])

AC_LANG_PUSH([C++])

Expand Down Expand Up @@ -387,7 +387,7 @@ if test "x$enable_debug" = xyes; then
[[$CXXFLAG_WERROR]])

AX_CHECK_PREPROC_FLAG([-DDEBUG],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG"]],,[[$CXXFLAG_WERROR]])
AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"]],,[[$CXXFLAG_WERROR]])
dnl AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"]],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-ftrapv],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"],,[[$CXXFLAG_WERROR]])
fi

Expand Down Expand Up @@ -453,12 +453,12 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
dnl some compilers will ignore -Wformat-security without -Wformat, so just combine the two here.
AX_CHECK_COMPILE_FLAG([-Wformat -Wformat-security],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat -Wformat-security"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wvla],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wvla"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wshadow-field],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wshadow-field"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wshadow-all],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wshadow-all"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wswitch],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wswitch"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wthread-safety],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wsign-compare],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsign-compare"],,[[$CXXFLAG_WERROR]])
Expand All @@ -468,7 +468,28 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Woverloaded-virtual"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]],
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=const],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-attribute=const"],,[[$CXXFLAG_WERROR]])
dnl AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=pure],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-attribute=pure"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=noreturn],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-attribute=noreturn"],,[[$CXXFLAG_WERROR]])
dnl AX_CHECK_COMPILE_FLAG([-Wsuggest-final-methods],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-final-methods"],,[[$CXXFLAG_WERROR]])
dnl AX_CHECK_COMPILE_FLAG([-Wsuggest-final-types],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-final-types"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wnon-virtual-dtor],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wnon-virtual-dtor"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Warray-bounds],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Warray-bounds"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wdisabled-optimization],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdisabled-optimization"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wuninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wuninitialized"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Winit-self],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Winit-self"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wmissing-include-dirs"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunsafe-loop-optimizations],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunsafe-loop-optimizations"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wvector-operation-performance],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wvector-operation-performance"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Winvalid-pch],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Winvalid-pch"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wcast-align],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wcast-align"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wnormalized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wnormalized"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wpacked],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wpacked"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wpointer-arith],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wpointer-arith"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wdouble-promotion],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdouble-promotion"],,[[$CXXFLAG_WERROR]])
dnl AX_CHECK_COMPILE_FLAG([-Wconversion],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconversion"],,[[$CXXFLAG_WERROR]])
dnl AX_CHECK_COMPILE_FLAG([-Wuseless-cast],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wuseless-cast"],,[[$CXXFLAG_WERROR]])

if test x$suppress_external_warnings != xno ; then
AX_CHECK_COMPILE_FLAG([-Wdocumentation],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdocumentation"],,[[$CXXFLAG_WERROR]])
Expand All @@ -477,13 +498,12 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
dnl unknown options if any other warning is produced. Test the -Wfoo case, and
dnl set the -Wno-foo case if it works.
AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wself-assign],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"],,[[$CXXFLAG_WERROR]])
fi


dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers],[[CXXFLAGS="$CXXFLAGS -fno-extended-identifiers"]],,[[$CXXFLAG_WERROR]])

Expand Down
2 changes: 1 addition & 1 deletion contrib/testgen/base58.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_bcaddress_version(strAddress):

if __name__ == '__main__':
# Test case (from http://gitorious.org/BGL/python-base58.git)
assert get_bcaddress_version('15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC') is 0
assert get_bcaddress_version('15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC') == 0
_ohai = 'o hai'.encode('ascii')
_tmp = b58encode(_ohai)
assert _tmp == 'DYB3oMS'
Expand Down
8 changes: 4 additions & 4 deletions src/BGL-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class AddrinfoRequestHandler : public BaseRequestHandler
}

public:
UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
UniValue PrepareRequest([[maybe_unused]] const std::string& method, const std::vector<std::string>& args) override
{
if (!args.empty()) {
throw std::runtime_error("-addrinfo takes no arguments");
Expand Down Expand Up @@ -294,7 +294,7 @@ class GetinfoRequestHandler: public BaseRequestHandler
const int ID_BALANCES = 3;

/** Create a simulated `getinfo` request. */
UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
UniValue PrepareRequest([[maybe_unused]] const std::string& method, const std::vector<std::string>& args) override
{
if (!args.empty()) {
throw std::runtime_error("-getinfo takes no arguments");
Expand Down Expand Up @@ -424,7 +424,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
static constexpr int ID_PEERINFO = 0;
static constexpr int ID_NETWORKINFO = 1;

UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
UniValue PrepareRequest([[maybe_unused]] const std::string& method, const std::vector<std::string>& args) override
{
if (!args.empty()) {
uint8_t n{0};
Expand Down Expand Up @@ -627,7 +627,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
class GenerateToAddressRequestHandler : public BaseRequestHandler
{
public:
UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
UniValue PrepareRequest([[maybe_unused]] const std::string& method, const std::vector<std::string>& args) override
{
address_str = args.at(1);
UniValue params{RPCConvertValues("generatetoaddress", args)};
Expand Down
2 changes: 1 addition & 1 deletion src/bench/base58.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void Base58CheckEncode(benchmark::Bench& bench)

static void Base58Decode(benchmark::Bench& bench)
{
const char* addr = "17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem";
const char* addr = "58sbDbzKTt1eVuXLeTJ8FqyWYed9wmP2pD";
std::vector<unsigned char> vch;
bench.batch(strlen(addr)).unit("byte").run([&] {
(void) DecodeBase58(addr, vch, 64);
Expand Down
5 changes: 3 additions & 2 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ class SigNetParams : public CChainParams {

genesis = CreateGenesisBlock(1598918400, 52613770, 0x1e0377ae, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
// assert(consensus.hashGenesisBlock == uint256S("0x00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6"));
// assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));

assert(consensus.hashGenesisBlock == uint256S("031d49b33598a1cb9559ae12feba7279cd944cd44b1862497aa38453751771fc"));
assert(genesis.hashMerkleRoot == uint256S("bb46c1c31b5660dd5fcd12aa9730dba0912952e4db9112331965fcdb32be74f5"));

vFixedSeeds.clear();

Expand Down
4 changes: 2 additions & 2 deletions src/coins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <random.h>
#include <version.h>

bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; }
bool CCoinsView::GetCoin([[maybe_unused]] const COutPoint &outpoint, [[maybe_unused]] Coin &coin) const { return false; }
uint256 CCoinsView::GetBestBlock() const { return uint256(); }
std::vector<uint256> CCoinsView::GetHeadBlocks() const { return std::vector<uint256>(); }
bool CCoinsView::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { return false; }
bool CCoinsView::BatchWrite([[maybe_unused]] CCoinsMap &mapCoins, [[maybe_unused]] const uint256 &hashBlock) { return false; }
CCoinsViewCursor *CCoinsView::Cursor() const { return nullptr; }

bool CCoinsView::HaveCoin(const COutPoint &outpoint) const
Expand Down
4 changes: 2 additions & 2 deletions src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef char* sockopt_arg_type;
#define USE_POLL
#endif

bool static inline IsSelectableSocket(const SOCKET& s) {
bool static inline IsSelectableSocket([[maybe_unused]] const SOCKET& s) {
#if defined(USE_POLL) || defined(WIN32)
return true;
#else
Expand All @@ -119,4 +119,4 @@ bool static inline IsSelectableSocket(const SOCKET& s) {
#define MSG_DONTWAIT 0
#endif

#endif // BGL_COMPAT_H
#endif // BGL_COMPAT_H
2 changes: 1 addition & 1 deletion src/core_memusage.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static inline size_t RecursiveDynamicUsage(const CScript& script) {
return memusage::DynamicUsage(script);
}

static inline size_t RecursiveDynamicUsage(const COutPoint& out) {
static inline size_t RecursiveDynamicUsage([[maybe_unused]] const COutPoint& out) {
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
}
}

void TxToUniv(const CTransaction& tx, const uint256& hashBlock, bool include_addresses, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo)
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, bool include_addresses, UniValue& entry, bool include_hex, int serialize_flags, [[maybe_unused]] const CTxUndo* txundo)
{
entry.pushKV("txid", tx.GetHash().GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
Expand Down
1 change: 0 additions & 1 deletion src/crypto/chacha_poly_aead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <assert.h>
#include <string.h>

#include <cstdio>
#include <limits>

#ifndef HAVE_TIMINGSAFE_BCMP
Expand Down
1 change: 0 additions & 1 deletion src/crypto/muhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <hash.h>

#include <cassert>
#include <cstdio>
#include <limits>

namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/ripemd160.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void inline Initialize(uint32_t* s)

uint32_t inline rol(uint32_t x, int i) { return (x << i) | (x >> (32 - i)); }

void inline Round(uint32_t& a, uint32_t b, uint32_t& c, uint32_t d, uint32_t e, uint32_t f, uint32_t x, uint32_t k, int r)
void inline Round(uint32_t& a, [[maybe_unused]] uint32_t b, uint32_t& c, [[maybe_unused]] uint32_t d, uint32_t e, uint32_t f, uint32_t x, uint32_t k, int r)
{
a = rol(a + f + x + k, r) + e;
c = rol(c, 10);
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace
namespace sha1
{
/** One round of SHA-1. */
void inline Round(uint32_t a, uint32_t& b, uint32_t c, uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
void inline Round(uint32_t a, uint32_t& b, [[maybe_unused]] uint32_t c, [[maybe_unused]] uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
{
e += ((a << 5) | (a >> 27)) + f + k + w;
b = (b << 30) | (b >> 2);
Expand Down
2 changes: 2 additions & 0 deletions src/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ unsigned int MurmurHash3(unsigned int nHashSeed, Span<const unsigned char> vData
switch (vDataToHash.size() & 3) {
case 3:
k1 ^= tail[2] << 16;
[[fallthrough]];
case 2:
k1 ^= tail[1] << 8;
[[fallthrough]];
case 1:
k1 ^= tail[0];
k1 *= c1;
Expand Down
4 changes: 2 additions & 2 deletions src/httprpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\"";
/** Simple one-shot callback timer to be used by the RPC mechanism to e.g.
* re-lock the wallet.
*/
class HTTPRPCTimer : public RPCTimerBase
class HTTPRPCTimer final : public RPCTimerBase
{
public:
HTTPRPCTimer(struct event_base* eventBase, std::function<void()>& func, int64_t millis) :
Expand All @@ -45,7 +45,7 @@ class HTTPRPCTimer : public RPCTimerBase
HTTPEvent ev;
};

class HTTPRPCTimerInterface : public RPCTimerInterface
class HTTPRPCTimerInterface final : public RPCTimerInterface
{
public:
explicit HTTPRPCTimerInterface(struct event_base* _base) : base(_base)
Expand Down
2 changes: 1 addition & 1 deletion src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m)
}

/** HTTP request callback */
static void http_request_cb(struct evhttp_request* req, void* arg)
static void http_request_cb(struct evhttp_request* req, [[maybe_unused]] void* arg)
{
// Disable reading to work around a libevent bug, fixed in 2.2.0.
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
Expand Down
2 changes: 1 addition & 1 deletion src/index/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class BaseIndex : public CValidationInterface
virtual bool Init();

/// Write update index entries for a newly connected block.
virtual bool WriteBlock(const CBlock& block, const CBlockIndex* pindex) { return true; }
virtual bool WriteBlock([[maybe_unused]] const CBlock& block, [[maybe_unused]] const CBlockIndex* pindex) { return true; }

/// Virtual method called internally by Commit that can be overridden to atomically
/// commit more index state.
Expand Down
2 changes: 1 addition & 1 deletion src/init/BGLd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BGLdInit : public interfaces::Init
} // namespace init

namespace interfaces {
std::unique_ptr<Init> MakeNodeInit(NodeContext& node, int argc, char* argv[], int& exit_status)
std::unique_ptr<Init> MakeNodeInit(NodeContext& node, [[maybe_unused]] int argc, [[maybe_unused]] char* argv[], [[maybe_unused]] int& exit_status)
{
return std::make_unique<init::BGLdInit>(node);
}
Expand Down
10 changes: 5 additions & 5 deletions src/interfaces/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ class Chain
{
public:
virtual ~Notifications() {}
virtual void transactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) {}
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) {}
virtual void blockConnected(const CBlock& block, int height) {}
virtual void blockDisconnected(const CBlock& block, int height) {}
virtual void transactionAddedToMempool([[maybe_unused]] const CTransactionRef& tx, [[maybe_unused]] uint64_t mempool_sequence) {}
virtual void transactionRemovedFromMempool([[maybe_unused]] const CTransactionRef& tx, [[maybe_unused]] MemPoolRemovalReason reason, [[maybe_unused]] uint64_t mempool_sequence) {}
virtual void blockConnected([[maybe_unused]] const CBlock& block, [[maybe_unused]] int height) {}
virtual void blockDisconnected([[maybe_unused]] const CBlock& block, [[maybe_unused]] int height) {}
virtual void updatedBlockTip() {}
virtual void chainStateFlushed(const CBlockLocator& locator) {}
virtual void chainStateFlushed([[maybe_unused]] const CBlockLocator& locator) {}
};

//! Register handler for notifications.
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace interfaces {
std::unique_ptr<Node> Init::makeNode() { return {}; }
std::unique_ptr<Chain> Init::makeChain() { return {}; }
std::unique_ptr<WalletClient> Init::makeWalletClient(Chain& chain) { return {}; }
std::unique_ptr<WalletClient> Init::makeWalletClient([[maybe_unused]] Chain& chain) { return {}; }
std::unique_ptr<Echo> Init::makeEcho() { return {}; }
Ipc* Init::ipc() { return nullptr; }
} // namespace interfaces
2 changes: 1 addition & 1 deletion src/interfaces/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class Node
//! Get and set internal node context. Useful for testing, but not
//! accessible across processes.
virtual NodeContext* context() { return nullptr; }
virtual void setContext(NodeContext* context) { }
virtual void setContext([[maybe_unused]] NodeContext* context) {}
};

//! Return implementation of Node interface.
Expand Down
2 changes: 1 addition & 1 deletion src/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CKey
}

//! Simple read-only vector-like interface.
unsigned int size() const { return (fValid ? keydata.size() : 0); }
size_t size() const { return (fValid ? keydata.size() : 0); }
const unsigned char* begin() const { return keydata.data(); }
const unsigned char* end() const { return keydata.data() + size(); }

Expand Down
2 changes: 1 addition & 1 deletion src/key_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DestinationEncoder
return bech32::Encode(bech32::Encoding::BECH32M, m_params.Bech32HRP(), data);
}

std::string operator()(const CNoDestination& no) const { return {}; }
std::string operator()([[maybe_unused]] const CNoDestination& no) const { return {}; }
};

CTxDestination DecodeDestination(const std::string& str, const CChainParams& params, std::string& error_str)
Expand Down
4 changes: 2 additions & 2 deletions src/leveldb/db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ struct leveldb_comparator_t : public Comparator {
const char* Name() const override { return (*name_)(state_); }

// No-ops since the C binding does not support key shortening methods.
void FindShortestSeparator(std::string*, const Slice&) const override {}
void FindShortSuccessor(std::string* key) const override {}
void FindShortestSeparator([[maybe_unused]] std::string*, [[maybe_unused]] const Slice&) const override {}
void FindShortSuccessor([[maybe_unused]] std::string* key) const override {}

void* state_;
void (*destructor_)(void*);
Expand Down
2 changes: 1 addition & 1 deletion src/leveldb/db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ struct IterState {
: mu(mutex), version(version), mem(mem), imm(imm) {}
};

static void CleanupIteratorState(void* arg1, void* arg2) {
static void CleanupIteratorState(void* arg1, [[maybe_unused]] void* arg2) {
IterState* state = reinterpret_cast<IterState*>(arg1);
state->mu->Lock();
state->mem->Unref();
Expand Down
Loading