From: W. Felix Handte Date: Thu, 12 Sep 2019 22:32:22 +0000 (-0400) Subject: Detect Whether We're Being Compiled with ASAN X-Git-Tag: v1.4.4~1^2~24^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edb6d884a593bb80c66825c8a476e47ded2d617a;p=thirdparty%2Fzstd.git Detect Whether We're Being Compiled with ASAN --- diff --git a/lib/common/mem.h b/lib/common/mem.h index acc7231e9..983b55edc 100644 --- a/lib/common/mem.h +++ b/lib/common/mem.h @@ -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 +#endif + /*-************************************************************** * Basic Types