naccyde / rpms / systemd

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