Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
ENABLE_DEBUG enables undefinied behavior sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Raab committed Jun 13, 2016
1 parent 054c4f3 commit 702cd0c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/ElektraCompiling.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set (CXX_EXTRA_FLAGS "${CXX_EXTRA_FLAGS} -Wold-style-cast")

message (STATUS "Clang detected")

if (ENABLE_DEBUG)
set (EXTRA_FLAGS "${EXTRA_FLAGS} -fsanitize=undefined -fsanitize=integer")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=undefined -fsanitize=integer")
endif()
endif()

if (CMAKE_COMPILER_IS_GNUCXX)
Expand Down

1 comment on commit 702cd0c

@rautesamtr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good way to go. I was about to suggest to use -fsanitize=address these days.

Please sign in to comment.