From c132731b260174f5939099ceb4fccde84710c502 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 3 Dec 2018 17:30:19 +0100
Subject: [PATCH] macro: define HAS_FEATURE_ADDRESS_SANITIZER also on gcc
Let's make differences between compilers more minimal.
Related: #2039327
(cherry picked from commit 01da36fadd365329cfd9e2c97eb419c63404b25f)
---
src/basic/macro.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 0fe6a62aa8..e87026882f 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -55,6 +55,19 @@
# endif
#endif
+#if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
+# ifdef __SANITIZE_ADDRESS__
+# define HAS_FEATURE_ADDRESS_SANITIZER 1
+# elif 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_DECLARATION_AFTER_STATEMENT \
_Pragma("GCC diagnostic push"); \