From 3443630a8c6c4891dd837c1d0e9786412ca20080 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 23 Aug 2023 03:19:48 +0700 Subject: [PATCH] ci: adds flag -Werror=reorder for arm target (#5540) ## Issue being fixed or feature implemented The order of members in a class/struct definition and the order of their initialization should match. This ensures that the code is more error-proof in cases where the order of member initializations is important, as they may depend on each other. Instead manual checking of member initialization better let CI handle it. Last PR where it's noticed: https://github.com/dashpay/dash/pull/5531#discussion_r1299404387 ## What was done? New flag "-Werror=reorder" for `configure.ac` and fixes existing code. ## How Has This Been Tested? Build code with `--enable-werror` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone --- configure.ac | 1 + src/evo/simplifiedmns.cpp | 6 +++--- src/evo/simplifiedmns.h | 2 +- src/net_processing.cpp | 2 +- src/qt/walletmodel.cpp | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index c7fdcb60b7..cf8c21a716 100644 --- a/configure.ac +++ b/configure.ac @@ -437,6 +437,7 @@ if test "x$enable_werror" = "xyes"; then if test "x$CXXFLAG_WERROR" = "x"; then AC_MSG_ERROR("enable-werror set but -Werror is not usable") fi + AX_CHECK_COMPILE_FLAG([-Werror=reorder],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=reorder"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=shadow-field],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=shadow-field"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=switch],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=switch"],,[[$CXXFLAG_WERROR]]) diff --git a/src/evo/simplifiedmns.cpp b/src/evo/simplifiedmns.cpp index 1194c3a8f5..d2dcf66c66 100644 --- a/src/evo/simplifiedmns.cpp +++ b/src/evo/simplifiedmns.cpp @@ -34,12 +34,12 @@ CSimplifiedMNListEntry::CSimplifiedMNListEntry(const CDeterministicMN& dmn) : pubKeyOperator(dmn.pdmnState->pubKeyOperator), keyIDVoting(dmn.pdmnState->keyIDVoting), isValid(!dmn.pdmnState->IsBanned()), + platformHTTPPort(dmn.pdmnState->platformHTTPPort), + platformNodeID(dmn.pdmnState->platformNodeID), scriptPayout(dmn.pdmnState->scriptPayout), scriptOperatorPayout(dmn.pdmnState->scriptOperatorPayout), nVersion(dmn.pdmnState->nVersion == CProRegTx::LEGACY_BLS_VERSION ? LEGACY_BLS_VERSION : BASIC_BLS_VERSION), - nType(dmn.nType), - platformHTTPPort(dmn.pdmnState->platformHTTPPort), - platformNodeID(dmn.pdmnState->platformNodeID) + nType(dmn.nType) { } diff --git a/src/evo/simplifiedmns.h b/src/evo/simplifiedmns.h index 09109a7808..8c9fa1c273 100644 --- a/src/evo/simplifiedmns.h +++ b/src/evo/simplifiedmns.h @@ -34,12 +34,12 @@ public: CBLSLazyPublicKey pubKeyOperator; CKeyID keyIDVoting; bool isValid{false}; - MnType nType{MnType::Regular}; uint16_t platformHTTPPort{0}; uint160 platformNodeID{}; CScript scriptPayout; // mem-only CScript scriptOperatorPayout; // mem-only uint16_t nVersion{LEGACY_BLS_VERSION}; + MnType nType{MnType::Regular}; CSimplifiedMNListEntry() = default; explicit CSimplifiedMNListEntry(const CDeterministicMN& dmn); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 28d8f85bb6..689353d267 100755 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -303,9 +303,9 @@ private: const CChainParams& m_chainparams; CConnman& m_connman; + CAddrMan& m_addrman; /** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */ BanMan* const m_banman; - CAddrMan& m_addrman; ChainstateManager& m_chainman; CTxMemPool& m_mempool; const std::unique_ptr& m_llmq_ctx; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index faadbdaaaf..4ac43a2914 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -46,9 +46,9 @@ WalletModel::WalletModel(std::unique_ptr wallet, ClientModel transactionTableModel(nullptr), recentRequestsTableModel(nullptr), cachedEncryptionStatus(Unencrypted), + timer(new QTimer(this)), cachedNumISLocks(0), - cachedCoinJoinRounds(0), - timer(new QTimer(this)) + cachedCoinJoinRounds(0) { fHaveWatchOnly = m_wallet->haveWatchOnly(); addressTableModel = new AddressTableModel(this);