Skip to content

Commit

Permalink
Add __clang__ macro conditionals to eliminate compile noise on GCC.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Oct 6, 2023
1 parent 0b21c10 commit 88dc383
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gridcoin/voting/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,14 @@ const PollRegistry::Sequence PollRegistry::Polls() const
{
LOCK(GetPollRegistry().cs_poll_registry);

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wthread-safety-reference"
#endif
return Sequence(m_polls);
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

}

Expand Down
4 changes: 4 additions & 0 deletions src/gridcoin/voting/result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,10 +920,14 @@ class VoteCounter
throw InvalidVoteError();
}

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wthread-safety-analysis"
#endif
ProcessLegacyVote(candidate.LegacyVote());
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}

//!
Expand Down
8 changes: 8 additions & 0 deletions src/rpc/voting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,16 @@ UniValue getpollresults(const UniValue& params, bool fHelp)
// We only need to lock the registry to retrieve the reference. If there is a reorg during the PollResultToJson, it will
// throw.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wthread-safety-analysis"
#endif
if (const PollReference* ref = WITH_LOCK(GetPollRegistry().cs_poll_registry, return TryPollByTitleOrId(title_or_id))) {
return PollResultToJson(*ref);
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

throw JSONRPCError(RPC_MISC_ERROR, "No matching poll found");
}
Expand Down Expand Up @@ -726,12 +730,16 @@ UniValue votedetails(const UniValue& params, bool fHelp)

// We only need to lock the registry to retrieve the reference. If there is a reorg during the PollResultToJson, it will
// throw.
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wthread-safety-analysis"
#endif
if (const PollReference* ref = WITH_LOCK(GetPollRegistry().cs_poll_registry, return TryPollByTitleOrId(title_or_id))) {
return VoteDetailsToJson(*ref);
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

throw JSONRPCError(RPC_MISC_ERROR, "No matching poll found");
}
4 changes: 4 additions & 0 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,10 +732,14 @@ template<typename Stream, typename T> void Unserialize(Stream& os, std::unique_p
template<typename Stream, typename T>
inline void Serialize(Stream& os, const T& a)
{
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wthread-safety-analysis"
#endif
a.Serialize(os);
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}

template<typename Stream, typename T>
Expand Down

0 comments on commit 88dc383

Please sign in to comment.