diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-10-02 17:30:54 -0700 |
---|---|---|
committer | Aina Niemetz <aina.niemetz@gmail.com> | 2018-10-02 17:30:54 -0700 |
commit | 457a5000f46cfd7ce58525b75930b87e8572c94f (patch) | |
tree | 1920baa5e2aa40a99ce102336cfa143ab86d788d | |
parent | 937d37ef78d3ef445335928d498422083df74d77 (diff) |
unit: Fix ASAN detection for GCC. (#2561)
-rw-r--r-- | test/unit/memory.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/test/unit/memory.h b/test/unit/memory.h index 86b024fa9..a4d650b3b 100644 --- a/test/unit/memory.h +++ b/test/unit/memory.h @@ -43,14 +43,25 @@ # define CVC4_MEMORY_LIMITING_DISABLED 1 # define CVC4_MEMORY_LIMITING_DISABLED_REASON "setrlimit() is broken on Mac." #else /* __APPLE__ */ +// Clang test # if defined(__has_feature) # if __has_feature(address_sanitizer) -// Tests cannot expect bad_alloc to be thrown due to limit memory using -// setrlimit when ASAN is enable. ASAN instead aborts on mmap failures. -# define CVC4_MEMORY_LIMITING_DISABLED 1 -# define CVC4_MEMORY_LIMITING_DISABLED_REASON "ASAN's mmap failures abort." +# define _IS_ASAN_BUILD # endif /* __has_feature(address_sanitizer) */ # endif /* defined(__has_feature) */ + +// GCC test +# if defined(__SANITIZE_ADDRESS__) +# define _IS_ASAN_BUILD +# endif /* defined(__SANITIZE_ADDRESS__) */ + +// Tests cannot expect bad_alloc to be thrown due to limit memory using +// setrlimit when ASAN is enable. ASAN instead aborts on mmap failures. +# if defined(_IS_ASAN_BUILD) +# define CVC4_MEMORY_LIMITING_DISABLED 1 +# define CVC4_MEMORY_LIMITING_DISABLED_REASON "ASAN's mmap failures abort." +# undef _IS_ASAN_BUILD +# endif /* defined(_IS_ASAN_BUILD) */ #endif |