From 6b92d34256fe1bca84e4b1988557aae2d52013b1 Mon Sep 17 00:00:00 2001 From: Dominik Thoennes <dominik.thoennes@fau.de> Date: Wed, 28 Oct 2020 12:32:31 +0100 Subject: [PATCH] extend WALBERLA_STL_BOUNDS_CHECK and use it in test --- CMakeLists.txt | 1 + src/waLBerlaDefinitions.in.h | 2 ++ tests/core/DebugSTLTest.cpp | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1abce0760..6f4df68cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -373,6 +373,7 @@ endif ( ) if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG ) if ( WALBERLA_STL_BOUNDS_CHECKS ) add_definitions ( "-D_GLIBCXX_DEBUG" ) + add_definitions ( "-D_LIBCPP_DEBUG" ) endif() endif() diff --git a/src/waLBerlaDefinitions.in.h b/src/waLBerlaDefinitions.in.h index 496f223b7..21d1dd6d3 100644 --- a/src/waLBerlaDefinitions.in.h +++ b/src/waLBerlaDefinitions.in.h @@ -41,6 +41,8 @@ #cmakedefine WALBERLA_THREAD_SAFE_LOGGING +#cmakedefine WALBERLA_STL_BOUNDS_CHECKS + // Compiler #cmakedefine WALBERLA_CXX_COMPILER_IS_GNU #cmakedefine WALBERLA_CXX_COMPILER_IS_INTEL diff --git a/tests/core/DebugSTLTest.cpp b/tests/core/DebugSTLTest.cpp index 4d588d5ce..760fc34b8 100644 --- a/tests/core/DebugSTLTest.cpp +++ b/tests/core/DebugSTLTest.cpp @@ -19,11 +19,12 @@ //====================================================================================================================== #include <vector> +#include "waLBerlaDefinitions.h" int main(int /*argc*/, char** /*argv*/) { int ret = 1; -#ifdef _GLIBCXX_DEBUG +#ifdef WALBERLA_STL_BOUNDS_CHECKS std::vector< int > a(100); // this throws an exception if the debug STL is used // otherwise main will return 0 and the test fails since it is expected to fail -- GitLab