Merge #18887: build: enable -Werror=gnu

a30b0a24e97eae7f6d1428c5bf339a579872f28e build: enable -Werror=gnu (Vasil Dimov)

Pull request description:

  Stop the build if a warning is emitted due to `-Wgnu` and
  `--enable-werror` has been used. As usual - this would help notice such
  a warning that is about to be introduced in new code.

  This is a followup to
  https://github.com/bitcoin/bitcoin/pull/18088 build: ensure we aren't using GNU extensions

ACKs for top commit:
  practicalswift:
    ACK a30b0a24e97eae7f6d1428c5bf339a579872f28e
  Empact:
    ACK a30b0a24e9

Tree-SHA512: f81b71cf3ee4db88b6f664c571075e0d30800a604f067f44273f256695a1dea533779db2ac859dd0a4cd8b66289c3e45f4aff1cfadfa160a1c354237167b05e2
This commit is contained in:
Wladimir J. van der Laan 2020-05-13 22:20:05 +02:00 committed by pasta
parent 62553fe226
commit 8bb8f59d32
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
5 changed files with 26 additions and 25 deletions

View File

@ -424,6 +424,7 @@ if test "x$enable_werror" = "xyes"; then
AC_MSG_ERROR("enable-werror set but -Werror is not usable") AC_MSG_ERROR("enable-werror set but -Werror is not usable")
fi fi
AX_CHECK_COMPILE_FLAG([-Werror=reorder],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=reorder"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=reorder],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=reorder"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Werror=gnu],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=gnu"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$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=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]]) AX_CHECK_COMPILE_FLAG([-Werror=switch],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=switch"],,[[$CXXFLAG_WERROR]])

View File

@ -36,11 +36,11 @@ UniValue CDKGDebugSessionStatus::ToJson(int quorumIndex, int detailLevel) const
ret.pushKV("quorumHeight", (int)quorumHeight); ret.pushKV("quorumHeight", (int)quorumHeight);
ret.pushKV("phase", ToUnderlying(phase)); ret.pushKV("phase", ToUnderlying(phase));
ret.pushKV("sentContributions", sentContributions); ret.pushKV("sentContributions", statusBits.sentContributions);
ret.pushKV("sentComplaint", sentComplaint); ret.pushKV("sentComplaint", statusBits.sentComplaint);
ret.pushKV("sentJustification", sentJustification); ret.pushKV("sentJustification", statusBits.sentJustification);
ret.pushKV("sentPrematureCommitment", sentPrematureCommitment); ret.pushKV("sentPrematureCommitment", statusBits.sentPrematureCommitment);
ret.pushKV("aborted", aborted); ret.pushKV("aborted", statusBits.aborted);
struct ArrOrCount { struct ArrOrCount {
int count{0}; int count{0};
@ -81,12 +81,12 @@ UniValue CDKGDebugSessionStatus::ToJson(int quorumIndex, int detailLevel) const
for (const auto i : irange::range(members.size())) { for (const auto i : irange::range(members.size())) {
const auto& m = members[i]; const auto& m = members[i];
add(badMembers, i, m.bad); add(badMembers, i, m.statusBits.bad);
add(weComplain, i, m.weComplain); add(weComplain, i, m.statusBits.weComplain);
add(receivedContributions, i, m.receivedContribution); add(receivedContributions, i, m.statusBits.receivedContribution);
add(receivedComplaints, i, m.receivedComplaint); add(receivedComplaints, i, m.statusBits.receivedComplaint);
add(receivedJustifications, i, m.receivedJustification); add(receivedJustifications, i, m.statusBits.receivedJustification);
add(receivedPrematureCommitments, i, m.receivedPrematureCommitment); add(receivedPrematureCommitments, i, m.statusBits.receivedPrematureCommitment);
} }
push(badMembers, "badMembers"); push(badMembers, "badMembers");
push(weComplain, "weComplain"); push(weComplain, "weComplain");

View File

@ -37,7 +37,7 @@ public:
bool receivedComplaint : 1; bool receivedComplaint : 1;
bool receivedJustification : 1; bool receivedJustification : 1;
bool receivedPrematureCommitment : 1; bool receivedPrematureCommitment : 1;
}; } statusBits;
uint8_t statusBitset; uint8_t statusBitset;
}; };
@ -65,7 +65,7 @@ public:
bool sentPrematureCommitment : 1; bool sentPrematureCommitment : 1;
bool aborted : 1; bool aborted : 1;
}; } statusBits;
uint8_t statusBitset; uint8_t statusBitset;
}; };

View File

@ -202,7 +202,7 @@ void CDKGSession::SendContributions(CDKGPendingMessages& pendingMessages)
logger.Flush(); logger.Flush();
dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) {
status.sentContributions = true; status.statusBits.sentContributions = true;
return true; return true;
}); });
@ -285,7 +285,7 @@ void CDKGSession::ReceiveMessage(const CDKGContribution& qc, bool& retBan)
RelayInvToParticipants(inv); RelayInvToParticipants(inv);
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) {
status.receivedContribution = true; status.statusBits.receivedContribution = true;
return true; return true;
}); });
@ -325,7 +325,7 @@ void CDKGSession::ReceiveMessage(const CDKGContribution& qc, bool& retBan)
if (complain) { if (complain) {
member->weComplain = true; member->weComplain = true;
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) {
status.weComplain = true; status.statusBits.weComplain = true;
return true; return true;
}); });
return; return;
@ -393,7 +393,7 @@ void CDKGSession::VerifyPendingContributions()
logger.Batch("invalid contribution from %s. will complain later", m->dmn->proTxHash.ToString()); logger.Batch("invalid contribution from %s. will complain later", m->dmn->proTxHash.ToString());
m->weComplain = true; m->weComplain = true;
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, m->idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, m->idx, [&](CDKGDebugMemberStatus& status) {
status.weComplain = true; status.statusBits.weComplain = true;
return true; return true;
}); });
} else { } else {
@ -520,7 +520,7 @@ void CDKGSession::SendComplaint(CDKGPendingMessages& pendingMessages)
logger.Flush(); logger.Flush();
dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) {
status.sentComplaint = true; status.statusBits.sentComplaint = true;
return true; return true;
}); });
@ -593,7 +593,7 @@ void CDKGSession::ReceiveMessage(const CDKGComplaint& qc, bool& retBan)
RelayInvToParticipants(inv); RelayInvToParticipants(inv);
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) {
status.receivedComplaint = true; status.statusBits.receivedComplaint = true;
return true; return true;
}); });
@ -714,7 +714,7 @@ void CDKGSession::SendJustification(CDKGPendingMessages& pendingMessages, const
logger.Flush(); logger.Flush();
dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) {
status.sentJustification = true; status.statusBits.sentJustification = true;
return true; return true;
}); });
@ -804,7 +804,7 @@ void CDKGSession::ReceiveMessage(const CDKGJustification& qj, bool& retBan)
RelayInvToParticipants(inv); RelayInvToParticipants(inv);
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) {
status.receivedJustification = true; status.statusBits.receivedJustification = true;
return true; return true;
}); });
@ -1026,7 +1026,7 @@ void CDKGSession::SendCommitment(CDKGPendingMessages& pendingMessages)
logger.Flush(); logger.Flush();
dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) {
status.sentPrematureCommitment = true; status.statusBits.sentPrematureCommitment = true;
return true; return true;
}); });
@ -1163,7 +1163,7 @@ void CDKGSession::ReceiveMessage(const CDKGPrematureCommitment& qc, bool& retBan
RelayInvToParticipants(inv); RelayInvToParticipants(inv);
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) {
status.receivedPrematureCommitment = true; status.statusBits.receivedPrematureCommitment = true;
return true; return true;
}); });
@ -1298,7 +1298,7 @@ void CDKGSession::MarkBadMember(size_t idx)
return; return;
} }
dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, idx, [&](CDKGDebugMemberStatus& status) { dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, idx, [&](CDKGDebugMemberStatus& status) {
status.bad = true; status.statusBits.bad = true;
return true; return true;
}); });
member->bad = true; member->bad = true;

View File

@ -567,7 +567,7 @@ void CDKGSessionHandler::PhaseHandlerThread()
HandleDKGRound(); HandleDKGRound();
} catch (AbortPhaseException& e) { } catch (AbortPhaseException& e) {
dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) {
status.aborted = true; status.statusBits.aborted = true;
return true; return true;
}); });
LogPrint(BCLog::LLMQ_DKG, "CDKGSessionHandler::%s -- %s qi[%d] - aborted current DKG session\n", __func__, params.name, quorumIndex); LogPrint(BCLog::LLMQ_DKG, "CDKGSessionHandler::%s -- %s qi[%d] - aborted current DKG session\n", __func__, params.name, quorumIndex);