Detect ASAN when using older GCC versions

Newer GCCs have __has_feature and older ones have
__SANITIZE_ADDRESS__[1]. Relevant since ASAN with GCC 11 on the popular
Ubuntu Jammy failed to build previously.

[1]: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/cpp/Common-Predefined-Macros.html
This commit is contained in:
Alan Wu 2024-12-16 17:11:36 -05:00
parent 0a99daa321
commit 2102fe32ff

View File

@ -16,7 +16,7 @@
#endif #endif
#ifdef HAVE_SANITIZER_ASAN_INTERFACE_H #ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
# if __has_feature(address_sanitizer) # if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
# define RUBY_ASAN_ENABLED # define RUBY_ASAN_ENABLED
# include <sanitizer/asan_interface.h> # include <sanitizer/asan_interface.h>
# endif # endif