From 5946795e82f778fff891c37f56c0d7a76a118bf9 Mon Sep 17 00:00:00 2001 From: Federico Ficarelli Date: Tue, 3 Jul 2018 11:13:22 +0200 Subject: [PATCH] Disable Intel invalid offsetof warning (#629) --- src/benchmark.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/benchmark.cc b/src/benchmark.cc index da553225..b14bc629 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -319,7 +319,10 @@ State::State(size_t max_iters, const std::vector& ranges, int thread_i, // demonstrated since constexpr evaluation must diagnose all undefined // behavior). However, GCC and Clang also warn about this use of offsetof, // which must be suppressed. -#ifdef __GNUC__ +#if defined(__INTEL_COMPILER) +#pragma warning push +#pragma warning(disable:1875) +#elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #endif @@ -328,7 +331,9 @@ State::State(size_t max_iters, const std::vector& ranges, int thread_i, static_assert(offsetof(State, error_occurred_) <= (cache_line_size - sizeof(error_occurred_)), ""); -#ifdef __GNUC__ +#if defined(__INTEL_COMPILER) +#pragma warning pop +#elif defined(__GNUC__) #pragma GCC diagnostic pop #endif }