diff --git a/osdep/compiler.h b/osdep/compiler.h index fead5dc7ec..07cdd147d7 100644 --- a/osdep/compiler.h +++ b/osdep/compiler.h @@ -16,13 +16,11 @@ #define MP_FALLTHROUGH __attribute__((fallthrough)) #define MP_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #define MP_UNUSED __attribute__((unused)) -#define MP_NO_ASAN __attribute__((no_sanitize("address"))) #else #define MP_NORETURN #define MP_FALLTHROUGH do {} while (0) #define MP_WARN_UNUSED_RESULT #define MP_UNUSED -#define MP_NO_ASAN #endif #if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 202311L) && !defined(thread_local) @@ -43,6 +41,12 @@ #define MP_NONSTRING #endif +#if __has_attribute(no_sanitize) +#define MP_NO_ASAN __attribute__((no_sanitize("address"))) +#else +#define MP_NO_ASAN +#endif + #ifndef NDEBUG #define MP_ASSERT_UNREACHABLE() assert(!"unreachable") #elif __has_builtin(__builtin_unreachable)