]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util-lib: introduce HAS_FEATURE_ADDRESS_SANITIZER
authorEvgeny Vereshchagin <evvers@ya.ru>
Sun, 2 Dec 2018 07:28:24 +0000 (08:28 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 16:35:42 +0000 (17:35 +0100)
https://clang.llvm.org/docs/AddressSanitizer.html#conditional-compilation-with-has-feature-address-sanitizer

src/basic/macro.h

index f8a8145de5948870e32e8163feb94d3f8c55664e..42ee753532eac5dd5f1d98722316cc1964fec5ea 100644 (file)
 #  endif
 #endif
 
+#if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
+#  if defined(__has_feature)
+#    if __has_feature(address_sanitizer)
+#      define HAS_FEATURE_ADDRESS_SANITIZER 1
+#    endif
+#  endif
+#  if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
+#    define HAS_FEATURE_ADDRESS_SANITIZER 0
+#  endif
+#endif
+
 /* Temporarily disable some warnings */
 #define DISABLE_WARNING_FORMAT_NONLITERAL                               \
         _Pragma("GCC diagnostic push");                                 \