From 88dc383b5960fc413cd1d5e3e23c9d0ff8e4bb54 Mon Sep 17 00:00:00 2001 From: "James C. Owens" Date: Fri, 6 Oct 2023 16:06:49 -0400 Subject: [PATCH] Add __clang__ macro conditionals to eliminate compile noise on GCC. --- src/gridcoin/voting/registry.cpp | 4 ++++ src/gridcoin/voting/result.cpp | 4 ++++ src/rpc/voting.cpp | 8 ++++++++ src/serialize.h | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/src/gridcoin/voting/registry.cpp b/src/gridcoin/voting/registry.cpp index 9c3a7468e9..871c36ac6e 100644 --- a/src/gridcoin/voting/registry.cpp +++ b/src/gridcoin/voting/registry.cpp @@ -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 } diff --git a/src/gridcoin/voting/result.cpp b/src/gridcoin/voting/result.cpp index a578b4fbf4..1cdd746eff 100644 --- a/src/gridcoin/voting/result.cpp +++ b/src/gridcoin/voting/result.cpp @@ -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 } //! diff --git a/src/rpc/voting.cpp b/src/rpc/voting.cpp index 02e720f518..68acf379e4 100644 --- a/src/rpc/voting.cpp +++ b/src/rpc/voting.cpp @@ -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"); } @@ -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"); } diff --git a/src/serialize.h b/src/serialize.h index 5d6ff5cacf..3c300b1e94 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -732,10 +732,14 @@ template void Unserialize(Stream& os, std::unique_p template 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