Skip to content

Commit

Permalink
Suppress invalid-offsetof warning for clang (#1821)
Browse files Browse the repository at this point in the history
For several compilers, `benchmark.cc` suppresses a warning regarding its use of `offsetof`. This merely extends that suppression to cover clang as well.
  • Loading branch information
DKLoehr authored Jul 24, 2024
1 parent df44bf7 commit fa236ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)
Expand Down

0 comments on commit fa236ed

Please sign in to comment.