From fa236ed6e6dea36dbc4982ffcca2945281e4433c Mon Sep 17 00:00:00 2001 From: Devon Loehr Date: Wed, 24 Jul 2024 08:12:04 -0400 Subject: [PATCH] Suppress invalid-offsetof warning for clang (#1821) For several compilers, `benchmark.cc` suppresses a warning regarding its use of `offsetof`. This merely extends that suppression to cover clang as well. --- src/benchmark.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchmark.cc b/src/benchmark.cc index 374c5141..2d085447 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -207,7 +207,7 @@ State::State(std::string name, IterationCount max_iters, #if defined(__INTEL_COMPILER) #pragma warning push #pragma warning(disable : 1875) -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #endif @@ -225,7 +225,7 @@ State::State(std::string name, IterationCount max_iters, offsetof(State, skipped_) <= (cache_line_size - sizeof(skipped_)), ""); #if defined(__INTEL_COMPILER) #pragma warning pop -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif #if defined(__NVCC__)