Skip to content

Commit

Permalink
add ENDABLE_UBSAN CMake option (#2155)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfomin authored Jan 26, 2025
1 parent cec33c2 commit a8e1749
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/WoofSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ if(ENABLE_ASAN)
_checked_add_link_option(-fsanitize=address)
endif()

option(ENABLE_UBSAN "Enable UBSan" OFF)
if(ENABLE_UBSAN)
# Set -Werror to catch "argument unused during compilation" warnings.
# Also needs to be a link flag for test to pass.
set(CMAKE_REQUIRED_FLAGS "-Werror -fsanitize=undefined")
_checked_add_compile_option(-fsanitize=undefined)
unset(CMAKE_REQUIRED_FLAGS)
_checked_add_link_option(-fsanitize=undefined)
endif()

option(ENABLE_TSAN "Enable TSan" OFF)
if(ENABLE_TSAN)
# Set -Werror to catch "argument unused during compilation" warnings.
Expand Down

0 comments on commit a8e1749

Please sign in to comment.