mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Auto-detect ASan at compile time (#638)
Fixes: https://github.com/quickjs-ng/quickjs/issues/636
This commit is contained in:
parent
eae9b23843
commit
56e5ffa2db
2 changed files with 9 additions and 3 deletions
|
@ -123,9 +123,6 @@ xoption(CONFIG_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF)
|
|||
|
||||
if(CONFIG_ASAN)
|
||||
message(STATUS "Building with ASan")
|
||||
add_compile_definitions(
|
||||
__ASAN__=1
|
||||
)
|
||||
add_compile_options(
|
||||
-fsanitize=address
|
||||
-fno-sanitize-recover=all
|
||||
|
@ -168,6 +165,7 @@ endif()
|
|||
|
||||
if(CONFIG_UBSAN)
|
||||
message(STATUS "Building with UBSan")
|
||||
# __has_feature(undefined_sanitizer) or __SANITIZE_UNDEFINED__ don't exist
|
||||
add_compile_definitions(
|
||||
__UBSAN__=1
|
||||
)
|
||||
|
|
8
cutils.h
8
cutils.h
|
@ -54,6 +54,14 @@ extern "C" {
|
|||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined(__SANITIZE_ADDRESS__)
|
||||
# define __ASAN__ 1
|
||||
#elif defined(__has_feature)
|
||||
# if __has_feature(address_sanitizer)
|
||||
# define __ASAN__ 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
|
|
Loading…
Reference in a new issue