File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -123,9 +123,6 @@ xoption(CONFIG_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF)
123
123
124
124
if (CONFIG_ASAN )
125
125
message (STATUS "Building with ASan" )
126
- add_compile_definitions (
127
- __ASAN__=1
128
- )
129
126
add_compile_options (
130
127
-fsanitize=address
131
128
-fno-sanitize-recover=all
@@ -168,6 +165,7 @@ endif()
168
165
169
166
if (CONFIG_UBSAN )
170
167
message (STATUS "Building with UBSan" )
168
+ # __has_feature(undefined_sanitizer) or __SANITIZE_UNDEFINED__ don't exist
171
169
add_compile_definitions (
172
170
__UBSAN__=1
173
171
)
Original file line number Diff line number Diff line change @@ -54,6 +54,14 @@ extern "C" {
54
54
#include <pthread.h>
55
55
#endif
56
56
57
+ #if defined(__SANITIZE_ADDRESS__ )
58
+ # define __ASAN__ 1
59
+ #elif defined(__has_feature )
60
+ # if __has_feature (address_sanitizer )
61
+ # define __ASAN__ 1
62
+ # endif
63
+ #endif
64
+
57
65
#if defined(_MSC_VER ) && !defined(__clang__ )
58
66
# define likely (x ) (x)
59
67
# define unlikely (x ) (x)
You can’t perform that action at this time.
0 commit comments