Detect Whether We're Being Compiled with ASAN

This commit is contained in:
W. Felix Handte
2019-10-10 13:40:16 -04:00
parent dc1fb684bf
commit edb6d884a5
+13
View File
@@ -74,6 +74,19 @@ void __msan_poison(const volatile void *a, size_t size);
intptr_t __msan_test_shadow(const volatile void *x, size_t size);
#endif
/* detects whether we are being compiled under asan */
#if defined (__has_feature)
# if __has_feature(address_sanitizer)
# define ADDRESS_SANITIZER 1
# endif
#elif defined(__SANITIZE_ADDRESS__)
# define ADDRESS_SANITIZER 1
#endif
#if defined (ADDRESS_SANITIZER)
# include <sanitizer/asan_interface.h>
#endif
/*-**************************************************************
* Basic Types