From 151ead6242b2075b5a3d55905440a3aab245a800 Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Thu, 7 Jun 2018 12:54:14 +0100 Subject: [PATCH] Disable deprecation warnings when -Werror is enabled. (#609) Fixes #608 --- CMakeLists.txt | 4 ++++ include/benchmark/benchmark.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f647c59..92745fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,10 @@ else() # Disable warnings regarding deprecated parts of the library while building # and testing those parts of the library. add_cxx_compiler_flag(-Wno-deprecated-declarations) + # Disable deprecation warnings for release builds (when -Werror is enabled). + add_cxx_compiler_flag(-Wno-deprecated RELEASE) + add_cxx_compiler_flag(-Wno-deprecated RELWITHDEBINFO) + add_cxx_compiler_flag(-Wno-deprecated MINSIZEREL) if (NOT BENCHMARK_ENABLE_EXCEPTIONS) add_cxx_compiler_flag(-fno-exceptions) endif() diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h index 5822250..be9498c 100644 --- a/include/benchmark/benchmark.h +++ b/include/benchmark/benchmark.h @@ -226,7 +226,7 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond); #define BENCHMARK_INTERNAL_TOSTRING2(x) #x #define BENCHMARK_INTERNAL_TOSTRING(x) BENCHMARK_INTERNAL_TOSTRING2(x) -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) #define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y) #define BENCHMARK_DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) #else