]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fileio.c: Disable backtrace when built with address sanitizer
authorJulian Fessard <julian.fessard@oculus.com>
Wed, 10 Oct 2018 00:14:57 +0000 (17:14 -0700)
committerJulian Fessard <julian.fessard@oculus.com>
Wed, 10 Oct 2018 00:14:57 +0000 (17:14 -0700)
Covers clang and gcc's sanitizer flags.
Can still be overridden through CFLAGS on commandline.

programs/fileio.c

index 8b1e9f2f224740b8469cc147d90b9a54e6ef111d..a2d5af2c431e88e3df574632be46ec49fde36fe1 100644 (file)
 #  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__)) )