From c4d3afdfadc8caa537621ea508b23e328b0aaafc Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 12 Jan 2017 16:25:07 +0000 Subject: [PATCH] Add new macro _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR to use in std::char_traits. This tells whether or not the builtin function __builtin_memcmp is constexpr. Only defined for clang 4.0 and later, and not true for any shipping version of Apple's clang. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291773 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/__config b/include/__config index fedec6112..c108b594b 100644 --- a/include/__config +++ b/include/__config @@ -396,6 +396,15 @@ namespace std { #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) #endif +// A constexpr version of __builtin_memcmp was added in clang 4.0 +#if __has_builtin(__builtin_memcmp) +# ifdef __apple_build_version__ +// No shipping version of Apple's clang has constexpr __builtin_memcmp +# elif __clang_major__ > 3 +# define _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR +# endif +#endif + #elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x)))