From 344775db633aef502a1ec9be967a2730a1e0c631 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Tue, 5 May 2015 12:13:20 +0100 Subject: [PATCH] Enable strict aliasing warnings --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20aec17e..911f3096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,15 +40,16 @@ add_cxx_compiler_flag(-pedantic-errors) add_cxx_compiler_flag(-Wshorten-64-to-32) add_cxx_compiler_flag(-Wfloat-equal) add_cxx_compiler_flag(-Wzero-as-null-pointer-constant) +add_cxx_compiler_flag(-fstrict-aliasing) +if (HAVE_CXX_FLAG_FSTRICT_ALIASING) + add_cxx_compiler_flag(-Wstrict-aliasing) +endif() add_cxx_compiler_flag(-Wthread-safety) if (HAVE_WTHREAD_SAFETY) add_definitions(-DHAVE_WTHREAD_SAFETY) cxx_feature_check(THREAD_SAFETY_ATTRIBUTES) endif() -# Release flags -add_cxx_compiler_flag(-fno-strict-aliasing RELEASE) - # Link time optimisation if (BENCHMARK_ENABLE_LTO) add_cxx_compiler_flag(-flto)