From 1e509c308e21679aa23cc4fed1416b82f406df2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 26 Sep 2018 01:09:44 +0200 Subject: [PATCH] Add ASAN detection macro (BOOST_CONTAINER_ASAN) --- include/boost/container/detail/workaround.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/boost/container/detail/workaround.hpp b/include/boost/container/detail/workaround.hpp index 736326b..1fea112 100644 --- a/include/boost/container/detail/workaround.hpp +++ b/include/boost/container/detail/workaround.hpp @@ -108,4 +108,15 @@ #define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE #endif +#if !defined(__has_feature) +#define BOOST_CONTAINER_HAS_FEATURE(feature) 0 +#else +#define BOOST_CONTAINER_HAS_FEATURE(feature) __has_feature(feature) +#endif + +//Detect address sanitizer +#if defined(__SANITIZE_ADDRESS__) || BOOST_CONTAINER_HAS_FEATURE(address_sanitizer) +#define BOOST_CONTAINER_ASAN +#endif + #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP