Skip to content

Commit

Permalink
ci: adds flag -Werror=reorder for arm target (#5540)
Browse files Browse the repository at this point in the history
## 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:
#5531 (comment)

## 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
  • Loading branch information
knst authored Aug 22, 2023
1 parent c37cbf3 commit 3443630
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
Expand Down
6 changes: 3 additions & 3 deletions src/evo/simplifiedmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/evo/simplifiedmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class CSimplifiedMNListEntry
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);
Expand Down
2 changes: 1 addition & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ class PeerManagerImpl final : public PeerManager

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<LLMQContext>& m_llmq_ctx;
Expand Down
4 changes: 2 additions & 2 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> 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);
Expand Down

0 comments on commit 3443630

Please sign in to comment.