fileio.c: Disable backtrace when built with address sanitizer

Covers clang and gcc's sanitizer flags.
Can still be overridden through CFLAGS on commandline.
This commit is contained in:
Julian Fessard 2018-10-09 17:14:57 -07:00
parent 1e0c5466c5
commit 70d8c2a031

View File

@ -20,6 +20,14 @@
# define _POSIX_SOURCE 1 /* disable %llu warnings with MinGW on Windows */
#endif
#if defined(__has_feature) && !defined(BACKTRACE_ENABLE) /* Clang compiler */
# if (__has_feature(address_sanitizer))
# define BACKTRACE_ENABLE 0
# endif /* __has_feature(address_sanitizer) */
#elif defined(__SANITIZE_ADDRESS__) && !defined(BACKTRACE_ENABLE) /* GCC compiler */
# define BACKTRACE_ENABLE 0
#endif
#if !defined(BACKTRACE_ENABLE) \
&& ((defined(__linux__) && defined(__GLIBC__)) \
|| (defined(__APPLE__) && defined(__MACH__)) )