From 5e92d7ac6c491811e4f275d147a06f4ecbca3aec Mon Sep 17 00:00:00 2001 From: Luc Pelletier Date: Fri, 13 May 2022 13:12:39 -0400 Subject: [PATCH 1/2] Fix compile warning in ThreadContext.h The _pad0 field of ThreadContext is unused and causes a compiler warning to be emitted with clang. This commit suppresses the warning for clang. --- quill/include/quill/detail/ThreadContext.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quill/include/quill/detail/ThreadContext.h b/quill/include/quill/detail/ThreadContext.h index 2734bef7..799a8c05 100644 --- a/quill/include/quill/detail/ThreadContext.h +++ b/quill/include/quill/detail/ThreadContext.h @@ -157,8 +157,13 @@ class ThreadContext #if defined(QUILL_USE_BOUNDED_QUEUE) alignas(CACHELINE_SIZE) std::atomic _dropped_message_counter{0}; +#ifdef __clang__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-private-field" char _pad0[detail::CACHELINE_SIZE - sizeof(std::atomic)] = "\0"; + #pragma GCC diagnostic pop +#endif #endif }; } // namespace detail -} // namespace quill \ No newline at end of file +} // namespace quill From 032a06026fade5b49171c9f43ce3681735cbd9c1 Mon Sep 17 00:00:00 2001 From: Luc Pelletier Date: Fri, 13 May 2022 13:56:17 -0400 Subject: [PATCH 2/2] Only use #ifdefs around macro suppression pragmas --- quill/include/quill/detail/ThreadContext.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quill/include/quill/detail/ThreadContext.h b/quill/include/quill/detail/ThreadContext.h index 799a8c05..fb608a08 100644 --- a/quill/include/quill/detail/ThreadContext.h +++ b/quill/include/quill/detail/ThreadContext.h @@ -160,7 +160,9 @@ class ThreadContext #ifdef __clang__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-private-field" +#endif char _pad0[detail::CACHELINE_SIZE - sizeof(std::atomic)] = "\0"; +#ifdef __clang__ #pragma GCC diagnostic pop #endif #endif