From: Timo Heister Date: Mon, 12 Aug 2024 20:26:25 +0000 (-0400) Subject: enable c++ standard library debug checks X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa36639b5a5e9f76b081c6cae4049999de629ff0;p=dealii.git enable c++ standard library debug checks --- diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake index 263c57bc85..321dbfd314 100644 --- a/cmake/setup_compiler_flags_gnu.cmake +++ b/cmake/setup_compiler_flags_gnu.cmake @@ -187,6 +187,13 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug") list(APPEND DEAL_II_DEFINITIONS_DEBUG "DEBUG") + # Enable invalid element access and other checks in the c++ standard libray: + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_GLIBCXX_ASSERTIONS") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_ENABLE_ASSERTIONS") + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE") + endif() + # # We have to ensure that we emit floating-point instructions in debug # mode that preserve the occurrence of floating-point exceptions and don't