17aa40
From 39b10c9e7e4ad80adc0e8c43f7d1917edee515dd Mon Sep 17 00:00:00 2001
17aa40
From: Evgeny Vereshchagin <evvers@ya.ru>
17aa40
Date: Sun, 2 Dec 2018 08:28:24 +0100
17aa40
Subject: [PATCH] util-lib: introduce HAS_FEATURE_ADDRESS_SANITIZER
eb8b6e
17aa40
https://clang.llvm.org/docs/AddressSanitizer.html#conditional-compilation-with-has-feature-address-sanitizer
17aa40
(cherry picked from commit 289acab951c5937fdf6d3a2666f411fd66dd20e5)
eb8b6e
17aa40
Related: #2017033
eb8b6e
---
17aa40
 src/basic/macro.h | 11 +++++++++++
17aa40
 1 file changed, 11 insertions(+)
eb8b6e
eb8b6e
diff --git a/src/basic/macro.h b/src/basic/macro.h
17aa40
index 0fe6a62aa8..62f2359633 100644
eb8b6e
--- a/src/basic/macro.h
eb8b6e
+++ b/src/basic/macro.h
17aa40
@@ -55,6 +55,17 @@
eb8b6e
 #  endif
eb8b6e
 #endif
eb8b6e
 
eb8b6e
+#if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
17aa40
+#  if defined(__has_feature)
eb8b6e
+#    if __has_feature(address_sanitizer)
eb8b6e
+#      define HAS_FEATURE_ADDRESS_SANITIZER 1
eb8b6e
+#    endif
eb8b6e
+#  endif
eb8b6e
+#  if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
eb8b6e
+#    define HAS_FEATURE_ADDRESS_SANITIZER 0
eb8b6e
+#  endif
eb8b6e
+#endif
eb8b6e
+
eb8b6e
 /* Temporarily disable some warnings */
eb8b6e
 #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT                     \
eb8b6e
         _Pragma("GCC diagnostic push");                                 \