diff --git a/tests/c_benchmarks/CMakeLists.txt b/tests/c_benchmarks/CMakeLists.txt index 43d1c3e8e..ca6155aa1 100644 --- a/tests/c_benchmarks/CMakeLists.txt +++ b/tests/c_benchmarks/CMakeLists.txt @@ -26,7 +26,8 @@ find_package(benchmark REQUIRED) # need -Wno-pedantic, for two reasons: # incompatibility in older libbenchmark, https://github.com/google/benchmark/issues/494#issuecomment-502444478 # PRIu64 macros without spaces around are invalid C++ (c.f. the C++11 value suffixes feature) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD_FLAGS} ${SANITIZE_FLAGS} -Wno-pedantic -Wno-unused-function") +# -fno-strict-aliasing: struct in C++ defines a type, causing a double definition (see issue #343) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD_FLAGS} ${SANITIZE_FLAGS} -Wno-pedantic -Wno-unused-function -fno-strict-aliasing") add_executable(c-benchmarks ../c_unittests/helpers.cpp diff --git a/tests/c_unittests/CMakeLists.txt b/tests/c_unittests/CMakeLists.txt index 5eb718694..1ca373c6a 100644 --- a/tests/c_unittests/CMakeLists.txt +++ b/tests/c_unittests/CMakeLists.txt @@ -19,7 +19,8 @@ # -fno-inline: just to be extra sure, no particular reason so far # -fno-builtin: GCC would optimize e.g. abs() and we would not be able to stub -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD_FLAGS} -fno-inline -fno-builtin -fno-stack-protector") +# -fno-strict-aliasing: struct in C++ defines a type, causing a double definition (see issue #343) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD_FLAGS} -fno-inline -fno-builtin -fno-stack-protector -fno-strict-aliasing") # DISPATCH-2196 Linking object files containing instances of the same C++ template fails on s390x with sanitizers enabled if(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x") # set the sanitizer flags only for linking, not for compilation; this workarounds the failure