MDEV-33974 Enable GNU libstdc++ debugging
Starting with GCC 10, let us enable _GLIBCXX_DEBUG as well as _GLIBCXX_ASSERTIONS which have an impact on the GNU libstdc++. On GCC 8, we observed a compilation failure related to some missing type conversion. Even though clang on GNU/Linux would default to using libstdc++ and enabling the debugging seems to work with clang-18, we will not enable this on clang, in case it would lead to compilation errors. For the clang libc++ before clang-15 there was _LIBCPP_DEBUG, but according to llvm/llvm-project@f3966eaf86 and llvm/llvm-project@13ea134323 and llvm/llvm-project@ff573a42cd it looks like that for proper results, a specially built debug version of libc++ would have to be used in order to enable equivalent checks. This should help catch bugs like the one that commit 455a15fd06b0f449e72e6b10b0474e4139eeeca2 fixed. Reviewed by: Sergei Golubchik
This commit is contained in:
parent
7229384256
commit
a1c1f5029e
@ -276,8 +276,6 @@ IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(wsrep)
|
||||
|
||||
OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_RETURN()/DBUG_PRINT()" ON)
|
||||
IF(WITH_DBUG_TRACE)
|
||||
FOREACH(LANG C CXX)
|
||||
@ -288,7 +286,12 @@ ENDIF()
|
||||
# Always enable debug sync for debug builds.
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
|
||||
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10")
|
||||
# Enable extra checks when using a recent enough version of GNU libstdc++
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS")
|
||||
ENDIF()
|
||||
|
||||
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
|
||||
IF (ENABLE_GCOV)
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-fprofile-arcs -ftest-coverage -lgcov" DEBUG)
|
||||
@ -349,6 +352,8 @@ ELSEIF(TRASH_FREED_MEMORY MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND AND
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTRASH_FREED_MEMORY")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(wsrep)
|
||||
|
||||
# Set commonly used variables
|
||||
IF(WIN32)
|
||||
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB ${MYSQL_BASE_VERSION}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user