fixed #12113 - made CMake build work with UBSAN and GCC (#5590)

GCC does not support `-fsanitize=nullability`
This commit is contained in:
Oliver Stöneberg 2023-10-24 21:53:58 +02:00 committed by GitHub
parent 89df134fed
commit 122e142726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -19,11 +19,17 @@ endif()
if(ANALYZE_UNDEFINED)
# TODO: enable signed-integer-overflow
add_compile_options(-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow)
add_compile_options(-fsanitize=undefined -fno-sanitize=signed-integer-overflow)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-fsanitize=nullability)
endif()
add_compile_options(-fno-sanitize-recover=all)
add_compile_options(-fno-omit-frame-pointer)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize=signed-integer-overflow")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=nullability")
endif()
endif()
if(ANALYZE_DATAFLOW)

View File

@ -28,3 +28,4 @@ Other:
- You can suppress warnings in a block of code using "-begin" and "-end".
- You can suppress warnings in current file using "-file".
- You can suppress all warnings where macro is used using "-macro"
- fixed CMake build with UBSAN and GCC