fix: resolve numerous compilation warnings under -Wall (#4599)

* fix: compilation warnings

./validation.h:266:13: warning: ‘bool AcceptToMemoryPoolWithTime(const CChainParams&, CTxMemPool&, CValidationState&, const CTransactionRef&, bool*, int64_t, bool, CAmount, bool)’ declared ‘static’ but never defined [-Wunused-function]
 static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~

* fix: compilation warnings

./coinjoin/client.h: In constructor ‘CCoinJoinClientManager::CCoinJoinClientManager(CWallet&)’:
./coinjoin/client.h:199:10: warning: ‘CCoinJoinClientManager::fCreateAutoBackups’ will be initialized after [-Wreorder]
     bool fCreateAutoBackups; // builtin support for automatic backups
          ^~~~~~~~~~~~~~~~~~
./coinjoin/client.h:187:14: warning:   ‘CWallet& CCoinJoinClientManager::mixingWallet’ [-Wreorder]
     CWallet& mixingWallet;
              ^~~~~~~~~~~~
./coinjoin/client.h:205:14: warning:   when initialized here [-Wreorder]
     explicit CCoinJoinClientManager(CWallet& wallet) :
              ^~~~~~~~~~~~~~~~~~~~~~

* fix: compilation warnings

interfaces/wallet.cpp: In constructor ‘interfaces::{anonymous}::WalletImpl::WalletImpl(const std::shared_ptr<CWallet>&)’:
interfaces/wallet.cpp:594:30: warning: ‘interfaces::{anonymous}::WalletImpl::m_wallet’ will be initialized after [-Wreorder]
     std::shared_ptr<CWallet> m_wallet;
                              ^~~~~~~~
interfaces/wallet.cpp:191:18: warning:   ‘interfaces::{anonymous}::CoinJoinImpl interfaces::{anonymous}::WalletImpl::m_coinjoin’ [-Wreorder]
     CoinJoinImpl m_coinjoin;
                  ^~~~~~~~~~
interfaces/wallet.cpp:193:14: warning:   when initialized here [-Wreorder]
     explicit WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_wallet(wallet), m_coinjoin(wallet) {}
              ^~~~~~~~~~

* fix: compilation warnings

validation.cpp:165:13: warning: ‘void CheckBlockIndex(const Consensus::Params&)’ declared ‘static’ but never defined [-Wunused-function]
 static void CheckBlockIndex(const Consensus::Params& consensusParams);
             ^~~~~~~~~~~~~~~

* fix: compilation warnings

bls/bls_worker.cpp: In constructor ‘ContributionVerifier::ContributionVerifier(CBLSId, const std::vector<std::shared_ptr<std::vector<CBLSPublicKey> > >&, const BLSSecretKeyVector&, size_t, bool, bool, ctpl::thread_pool&, std::function<void(const std::vector<bool>&)>)’:
bls/bls_worker.cpp:425:51: warning: ‘ContributionVerifier::doneCallback’ will be initialized after [-Wreorder]
     std::function<void(const std::vector<bool>&)> doneCallback;
                                                   ^~~~~~~~~~~~
bls/bls_worker.cpp:420:12: warning:   ‘size_t ContributionVerifier::batchCount’ [-Wreorder]
     size_t batchCount;
            ^~~~~~~~~~
bls/bls_worker.cpp:427:5: warning:   when initialized here [-Wreorder]
     ContributionVerifier(CBLSId _forId, const std::vector<BLSVerificationVectorPtr>& _vvecs,
     ^~~~~~~~~~~~~~~~~~~~

* fix: compilation warnings

bls/bls_worker.cpp:342:10: warning: ‘VectorAggregator<CBLSPublicKey>::parallel’ will be initialized after [-Wreorder]
     bool parallel;
          ^~~~~~~~
bls/bls_worker.cpp:340:12: warning:   ‘size_t VectorAggregator<CBLSPublicKey>::start’ [-Wreorder]
     size_t start;
            ^~~~~
bls/bls_worker.cpp:350:5: warning:   when initialized here [-Wreorder]
     VectorAggregator(const VectorVectorType& _vecs,
     ^~~~~~~~~~~~~~~~
bls/bls_worker.cpp:343:24: warning: ‘VectorAggregator<CBLSPublicKey>::workerPool’ will be initialized after [-Wreorder]
     ctpl::thread_pool& workerPool;
                        ^~~~~~~~~~
bls/bls_worker.cpp:337:18: warning:   ‘VectorAggregator<CBLSPublicKey>::DoneCallback VectorAggregator<CBLSPublicKey>::doneCallback’ [-Wreorder]
     DoneCallback doneCallback;
                  ^~~~~~~~~~~~
bls/bls_worker.cpp:350:5: warning:   when initialized here [-Wreorder]
     VectorAggregator(const VectorVectorType& _vecs,
     ^~~~~~~~~~~~~~~~

* fix: compilation warnings

bls/bls_worker.cpp:494:235:   required from here
bls/bls_worker.cpp:136:24: warning: ‘Aggregator<CBLSSecretKey>::workerPool’ will be initialized after [-Wreorder]
     ctpl::thread_pool& workerPool;
                        ^~~~~~~~~~
bls/bls_worker.cpp:135:10: warning:   ‘bool Aggregator<CBLSSecretKey>::parallel’ [-Wreorder]
     bool parallel;
          ^~~~~~~~
bls/bls_worker.cpp:152:5: warning:   when initialized here [-Wreorder]
     Aggregator(const std::vector<TP>& _inputVec,
     ^~~~~~~~~~

* fix: compilation warnings

bench/string_cast.cpp: In lambda function:
bench/string_cast.cpp:22:13: warning: statement has no effect [-Wunused-value]
         atoi("1");
         ~~~~^~~~~

* fix: compilation warnings

./llmq/dkgsessionhandler.h: In constructor ‘llmq::CDKGPendingMessages::CDKGPendingMessages(size_t, int)’:
./llmq/dkgsessionhandler.h:48:12: warning: ‘llmq::CDKGPendingMessages::maxMessagesPerNode’ will be initialized after [-Wreorder]
     size_t maxMessagesPerNode GUARDED_BY(cs);
            ^~~~~~~~~~~~~~~~~~
./llmq/dkgsessionhandler.h:47:15: warning:   ‘const int llmq::CDKGPendingMessages::invType’ [-Wreorder]
     const int invType;
               ^~~~~~~
llmq/dkgsessionhandler.cpp:23:1: warning:   when initialized here [-Wreorder]
 CDKGPendingMessages::CDKGPendingMessages(size_t _maxMessagesPerNode, int _invType) :
 ^~~~~~~~~~~~~~~~~~~

* fix: compilation warnings

Not sure this one is correct, but I believe so. Seems like the `!= 0` is completely not needed

rpc/masternode.cpp: In function ‘UniValue masternode_payments(const JSONRPCRequest&)’:
rpc/masternode.cpp:442:31: warning: suggest parentheses around comparison in operand of ‘!=’ [-Wparentheses]
     while (vecPayments.size() < std::abs(nCount) != 0 && pindex != nullptr) {
            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~

* fix: compilation warnings

test/cachemultimap_tests.cpp:14:13: warning: ‘void cachemultimap_tests::DumpMap(const CacheMultiMap<int, int>&)’ defined but not used [-Wunused-function]
 static void DumpMap(const CacheMultiMap<int,int>& cmmap)
             ^~~~~~~

* fix: compilation warnings

In file included from qt/appearancewidget.cpp:11:
./qt/appearancewidget.h: In constructor ‘AppearanceWidget::AppearanceWidget(QWidget*)’:
./qt/appearancewidget.h:52:25: warning: ‘AppearanceWidget::prevFontFamily’ will be initialized after [-Wreorder]
     GUIUtil::FontFamily prevFontFamily;
                         ^~~~~~~~~~~~~~
./qt/appearancewidget.h:51:9: warning:   ‘int AppearanceWidget::prevScale’ [-Wreorder]
     int prevScale;
         ^~~~~~~~~
qt/appearancewidget.cpp:21:1: warning:   when initialized here [-Wreorder]
 AppearanceWidget::AppearanceWidget(QWidget* parent) :
 ^~~~~~~~~~~~~~~~

* fix: compilation warnings

In file included from qt/bitcoingui.cpp:6:
./qt/bitcoingui.h: In constructor ‘BitcoinGUI::BitcoinGUI(interfaces::Node&, const NetworkStyle*, QWidget*)’:
./qt/bitcoingui.h:212:31: warning: ‘BitcoinGUI::m_network_style’ will be initialized after [-Wreorder]
     const NetworkStyle* const m_network_style;
                               ^~~~~~~~~~~~~~~
./qt/bitcoingui.h:172:34: warning:   ‘const std::unique_ptr<QMenu> BitcoinGUI::trayIconMenu’ [-Wreorder]
     const std::unique_ptr<QMenu> trayIconMenu;
                                  ^~~~~~~~~~~~
qt/bitcoingui.cpp:81:1: warning:   when initialized here [-Wreorder]
 BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, QWidget* parent) :
 ^~~~~~~~~~

* fix: compilation warnings

In file included from qt/masternodelist.cpp:1:
./qt/masternodelist.h: In constructor ‘MasternodeList::MasternodeList(QWidget*)’:
./qt/masternodelist.h:66:18: warning: ‘MasternodeList::walletModel’ will be initialized after [-Wreorder]
     WalletModel* walletModel;
                  ^~~~~~~~~~~
./qt/masternodelist.h:61:10: warning:   ‘bool MasternodeList::fFilterUpdatedDIP3’ [-Wreorder]
     bool fFilterUpdatedDIP3;
          ^~~~~~~~~~~~~~~~~~
qt/masternodelist.cpp:45:1: warning:   when initialized here [-Wreorder]
 MasternodeList::MasternodeList(QWidget* parent) :
 ^~~~~~~~~~~~~~
In file included from qt/masternodelist.cpp:1:
./qt/masternodelist.h:61:10: warning: ‘MasternodeList::fFilterUpdatedDIP3’ will be initialized after [-Wreorder]
     bool fFilterUpdatedDIP3;
          ^~~~~~~~~~~~~~~~~~
./qt/masternodelist.h:59:13: warning:   ‘int64_t MasternodeList::nTimeFilterUpdatedDIP3’ [-Wreorder]
     int64_t nTimeFilterUpdatedDIP3;
             ^~~~~~~~~~~~~~~~~~~~~~
qt/masternodelist.cpp:45:1: warning:   when initialized here [-Wreorder]
 MasternodeList::MasternodeList(QWidget* parent) :
 ^~~~~~~~~~~~~~

* fix: compilation warnings

In file included from qt/paymentserver.cpp:10:
./qt/paymentserver.h: In constructor ‘PaymentServer::PaymentServer(QObject*, bool)’:
./qt/paymentserver.h:156:28: warning: ‘PaymentServer::netManager’ will be initialized after [-Wreorder]
     QNetworkAccessManager* netManager;  // Used to fetch payment requests
                            ^~~~~~~~~~
./qt/paymentserver.h:147:19: warning:   ‘OptionsModel* PaymentServer::optionsModel’ [-Wreorder]
     OptionsModel *optionsModel;
                   ^~~~~~~~~~~~
qt/paymentserver.cpp:197:1: warning:   when initialized here [-Wreorder]
 PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
 ^~~~~~~~~~~~~
This commit is contained in:
PastaPastaPasta 2021-12-01 14:59:34 -05:00 committed by GitHub
parent 49bd9bdc1b
commit 40c259bdf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 42 additions and 79 deletions

View File

@ -18,8 +18,9 @@ std::string NumberToString(T Number){
static void int_atoi(benchmark::Bench& bench)
{
int value;
bench.run([&] {
atoi("1");
value = atoi("1");
});
}

View File

@ -154,8 +154,8 @@ struct Aggregator : public std::enable_shared_from_this<Aggregator<T>> {
bool _parallel,
ctpl::thread_pool& _workerPool,
DoneCallback _doneCallback) :
workerPool(_workerPool),
parallel(_parallel),
workerPool(_workerPool),
doneCallback(std::move(_doneCallback))
{
inputVec = std::make_shared<std::vector<const T*> >(count);
@ -342,7 +342,7 @@ struct VectorAggregator : public std::enable_shared_from_this<VectorAggregator<T
bool parallel;
ctpl::thread_pool& workerPool;
std::atomic<size_t> doneCount;
std::atomic<size_t> doneCount{0};
VectorPtrType result;
size_t vecSize;
@ -351,13 +351,12 @@ struct VectorAggregator : public std::enable_shared_from_this<VectorAggregator<T
size_t _start, size_t _count,
bool _parallel, ctpl::thread_pool& _workerPool,
DoneCallback _doneCallback) :
doneCallback(std::move(_doneCallback)),
vecs(_vecs),
parallel(_parallel),
start(_start),
count(_count),
workerPool(_workerPool),
doneCallback(std::move(_doneCallback)),
doneCount(0)
parallel(_parallel),
workerPool(_workerPool)
{
assert(!vecs.empty());
vecSize = vecs[0]->size();
@ -417,7 +416,7 @@ struct ContributionVerifier : public std::enable_shared_from_this<ContributionVe
ctpl::thread_pool& workerPool;
size_t batchCount;
size_t batchCount{1};
size_t verifyCount;
std::vector<BatchState> batchStates;
@ -435,9 +434,8 @@ struct ContributionVerifier : public std::enable_shared_from_this<ContributionVe
parallel(_parallel),
aggregated(_aggregated),
workerPool(_workerPool),
doneCallback(std::move(_doneCallback)),
batchCount(1),
verifyCount(_vvecs.size())
verifyCount(_vvecs.size()),
doneCallback(std::move(_doneCallback))
{
}

View File

@ -180,14 +180,14 @@ private:
bool fMixing{false};
int nCachedLastSuccessBlock;
int nMinBlocksToWait; // how many blocks to wait for after one successful mixing tx in non-multisession mode
int nCachedLastSuccessBlock{0};
int nMinBlocksToWait{1}; // how many blocks to wait for after one successful mixing tx in non-multisession mode
std::string strAutoDenomResult;
CWallet& mixingWallet;
// Keep track of current block height
int nCachedBlockHeight;
int nCachedBlockHeight{0};
bool WaitForAnotherBlock() const;
@ -195,25 +195,15 @@ private:
bool CheckAutomaticBackup();
public:
int nCachedNumBlocks; // used for the overview screen
bool fCreateAutoBackups; // builtin support for automatic backups
int nCachedNumBlocks{std::numeric_limits<int>::max()}; // used for the overview screen
bool fCreateAutoBackups{true}; // builtin support for automatic backups
CCoinJoinClientManager() = delete;
CCoinJoinClientManager(CCoinJoinClientManager const&) = delete;
CCoinJoinClientManager& operator=(CCoinJoinClientManager const&) = delete;
explicit CCoinJoinClientManager(CWallet& wallet) :
vecMasternodesUsed(),
deqSessions(),
nCachedLastSuccessBlock(0),
nMinBlocksToWait(1),
strAutoDenomResult(),
nCachedBlockHeight(0),
nCachedNumBlocks(std::numeric_limits<int>::max()),
fCreateAutoBackups(true),
mixingWallet(wallet)
{
}
mixingWallet(wallet) {}
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman, bool enable_bip61);

View File

@ -188,7 +188,6 @@ public:
class WalletImpl : public Wallet
{
public:
CoinJoinImpl m_coinjoin;
explicit WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_wallet(wallet), m_coinjoin(wallet) {}
@ -592,6 +591,7 @@ public:
}
std::shared_ptr<CWallet> m_wallet;
CoinJoinImpl m_coinjoin;
};
class WalletClientImpl : public ChainClient

View File

@ -21,8 +21,8 @@ namespace llmq
{
CDKGPendingMessages::CDKGPendingMessages(size_t _maxMessagesPerNode, int _invType) :
maxMessagesPerNode(_maxMessagesPerNode),
invType(_invType)
invType(_invType),
maxMessagesPerNode(_maxMessagesPerNode)
{
}

View File

@ -20,13 +20,7 @@
AppearanceWidget::AppearanceWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::AppearanceWidget),
fAcceptChanges(false),
prevTheme(GUIUtil::getActiveTheme()),
prevFontFamily(GUIUtil::getFontFamily()),
prevScale(GUIUtil::getFontScale()),
prevWeightNormal(GUIUtil::getFontWeightNormal()),
prevWeightBold(GUIUtil::getFontWeightBold())
ui{new Ui::AppearanceWidget()}
{
ui->setupUi(this);

View File

@ -46,12 +46,12 @@ private:
Ui::AppearanceWidget* ui;
QDataWidgetMapper* mapper;
OptionsModel* model;
bool fAcceptChanges;
QString prevTheme;
int prevScale;
GUIUtil::FontFamily prevFontFamily;
QFont::Weight prevWeightNormal;
QFont::Weight prevWeightBold;
bool fAcceptChanges{false};
QString prevTheme{GUIUtil::getActiveTheme()};
int prevScale{GUIUtil::getFontScale()};
GUIUtil::FontFamily prevFontFamily{GUIUtil::getFontFamily()};
QFont::Weight prevWeightNormal{GUIUtil::getFontWeightNormal()};
QFont::Weight prevWeightBold{GUIUtil::getFontWeightBold()};
void updateWeightSlider(bool fForce = false);
};

View File

@ -81,8 +81,8 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, QWidget* parent) :
QMainWindow(parent),
m_node(node),
m_network_style(networkStyle),
trayIconMenu{new QMenu()}
trayIconMenu{new QMenu()},
m_network_style(networkStyle)
{
GUIUtil::loadTheme(true);

View File

@ -44,13 +44,7 @@ public:
MasternodeList::MasternodeList(QWidget* parent) :
QWidget(parent),
ui(new Ui::MasternodeList),
clientModel(0),
walletModel(0),
fFilterUpdatedDIP3(true),
nTimeFilterUpdatedDIP3(0),
nTimeUpdatedDIP3(0),
mnListChanged(true)
ui(new Ui::MasternodeList)
{
ui->setupUi(this);

View File

@ -56,21 +56,21 @@ public:
private:
QMenu* contextMenuDIP3;
int64_t nTimeFilterUpdatedDIP3;
int64_t nTimeUpdatedDIP3;
bool fFilterUpdatedDIP3;
int64_t nTimeFilterUpdatedDIP3{0};
int64_t nTimeUpdatedDIP3{0};
bool fFilterUpdatedDIP3{true};
QTimer* timer;
Ui::MasternodeList* ui;
ClientModel* clientModel;
WalletModel* walletModel;
ClientModel* clientModel{nullptr};
WalletModel* walletModel{nullptr};
// Protects tableWidgetMasternodesDIP3
CCriticalSection cs_dip3list;
QString strCurrentFilterDIP3;
bool mnListChanged;
bool mnListChanged{true};
CDeterministicMNCPtr GetSelectedDIP3MN();

View File

@ -196,11 +196,11 @@ bool PaymentServer::ipcSendCommandLine()
PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
QObject(parent),
saveURIs(true),
uriServer(nullptr),
#ifdef ENABLE_BIP70
netManager(nullptr),
#endif
saveURIs(true),
uriServer(nullptr),
optionsModel(nullptr)
{
#ifdef ENABLE_BIP70

View File

@ -142,10 +142,6 @@ protected:
bool eventFilter(QObject *object, QEvent *event) override;
private:
bool saveURIs; // true during startup
QLocalServer* uriServer;
OptionsModel *optionsModel;
#ifdef ENABLE_BIP70
static bool readPaymentRequestFromFile(const QString& filename, PaymentRequestPlus& request);
bool processPaymentRequest(const PaymentRequestPlus& request, SendCoinsRecipient& recipient);
@ -155,6 +151,10 @@ private:
void initNetManager();
QNetworkAccessManager* netManager; // Used to fetch payment requests
#endif
bool saveURIs; // true during startup
QLocalServer* uriServer;
OptionsModel *optionsModel;
};
#endif // BITCOIN_QT_PAYMENTSERVER_H

View File

@ -439,7 +439,7 @@ static UniValue masternode_payments(const JSONRPCRequest& request)
// A temporary vector which is used to sort results properly (there is no "reverse" in/for UniValue)
std::vector<UniValue> vecPayments;
while (vecPayments.size() < std::abs(nCount) != 0 && pindex != nullptr) {
while (vecPayments.size() < std::abs(nCount) && pindex != nullptr) {
CBlock block;
if (!ReadBlockFromDisk(block, pindex, Params().GetConsensus())) {

View File

@ -11,15 +11,6 @@
BOOST_FIXTURE_TEST_SUITE(cachemultimap_tests, BasicTestingSetup)
static void DumpMap(const CacheMultiMap<int,int>& cmmap)
{
const CacheMultiMap<int,int>::list_t& listItems = cmmap.GetItemList();
for(CacheMultiMap<int,int>::list_cit it = listItems.begin(); it != listItems.end(); ++it) {
const CacheItem<int,int>& item = *it;
std::cout << item.key << " : " << item.value << std::endl;
}
}
static bool Compare(const CacheMultiMap<int,int>& cmmap1, const CacheMultiMap<int,int>& cmmap2)
{
if(cmmap1.GetMaxSize() != cmmap2.GetMaxSize()) {

View File

@ -162,8 +162,6 @@ CBlockPolicyEstimator feeEstimator;
CTxMemPool mempool(&feeEstimator);
std::atomic_bool g_is_mempool_loaded{false};
static void CheckBlockIndex(const Consensus::Params& consensusParams);
// Internal stuff
namespace {
CBlockIndex* pindexBestInvalid = nullptr;

View File

@ -263,9 +263,6 @@ void PruneBlockFilesManual(int nManualPruneHeight);
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
bool* pfMissingInputs, bool bypass_limits,
const CAmount nAbsurdFee, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
bool* pfMissingInputs, int64_t nAcceptTime, bool bypass_limits,
const CAmount nAbsurdFee, bool test_accept = false);
bool GetUTXOCoin(const COutPoint& outpoint, Coin& coin);
int GetUTXOHeight(const COutPoint& outpoint);