Skip to content

Commit 6813065

Browse files
committed
wip: Use undefined-behavior sanitizer
In theory, this should cause failures when the tests run (make check) if there are problems. Ideally, we could enable this only for some builds in the CI.
1 parent 051d1ca commit 6813065

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ endif()
4444
# Add compiler warning flags & turn warnings into errors
4545
add_compile_options(
4646
"$<$<OR:$<CXX_COMPILER_ID:MSVC>,$<C_COMPILER_ID:MSVC>>:/W4;/WX>"
47-
"$<$<OR:$<CXX_COMPILER_ID:GNU>,$<C_COMPILER_ID:GNU>>:-pedantic;-Wall;-Wextra;-Wsuggest-override;-Wshadow;-Wzero-as-null-pointer-constant;-Wformat-security>"
47+
"$<$<OR:$<CXX_COMPILER_ID:GNU>,$<C_COMPILER_ID:GNU>>:-pedantic;-Wall;-Wextra;-Wsuggest-override;-Wshadow;-Wzero-as-null-pointer-constant;-Wformat-security -fsanitize=undefined>"
4848
"$<$<OR:$<CXX_COMPILER_ID:Clang>,$<C_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:AppleClang>>:-pedantic;-Wall;-Wextra;-Wshadow;-Wzero-as-null-pointer-constant;-Wformat-security>"
4949
)
5050

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ AS_IF([test "x$config_error" = xyes],
5353
# Evaluate the --enable-warnings=level option.
5454
MM_ARG_ENABLE_WARNINGS([SIGC_WXXFLAGS],
5555
[-Wall],
56-
[-pedantic -Wall -Wextra -Wsuggest-override -Wshadow -Wzero-as-null-pointer-constant -Wformat-security])
56+
[-pedantic -Wall -Wextra -Wsuggest-override -Wshadow -Wzero-as-null-pointer-constant -Wformat-security -fsanitize=undefined])
5757

5858
# Offer the ability to omit some API from the library.
5959
MM_ARG_DISABLE_DEPRECATED_API([SIGCXX])

0 commit comments

Comments
 (0)