summaryrefslogtreecommitdiff
path: root/include/__string
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-29 20:59:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-29 20:59:02 +0000
commit3efcd4e54b8b374c90b362d763a726b9e025efae (patch)
tree11dad958946a61a8fc5051e9e9453d98a2742421 /include/__string
parent90c3c6c2a0a0afd28cbb5e117b278bdcdebfd85f (diff)
Vendor import of libc++ release_40 branch r293443:vendor/libc++/libc++-release_40-r293443
Notes
svn path=/vendor/libc++/dist/; revision=312962 svn path=/vendor/libc++/libc++-release_40-r293443/; revision=312963; tag=vendor/libc++/libc++-release_40-r293443
Diffstat (limited to 'include/__string')
-rw-r--r--include/__string12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/__string b/include/__string
index c85b874f054b..75608cea71d9 100644
--- a/include/__string
+++ b/include/__string
@@ -243,7 +243,7 @@ char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t
{
if (__n == 0)
return 0;
-#ifdef _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_memcmp(__s1, __s2, __n);
#elif _LIBCPP_STD_VER <= 14
return memcmp(__s1, __s2, __n);
@@ -265,7 +265,9 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
{
if (__n == 0)
return NULL;
-#if _LIBCPP_STD_VER <= 14
+#if __has_feature(cxx_constexpr_string_builtins)
+ return __builtin_char_memchr(__s, to_int_type(__a), __n);
+#elif _LIBCPP_STD_VER <= 14
return (const char_type*) memchr(__s, to_int_type(__a), __n);
#else
for (; __n; --__n)
@@ -331,7 +333,7 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
{
if (__n == 0)
return 0;
-#if __has_builtin(__builtin_wmemcmp)
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_wmemcmp(__s1, __s2, __n);
#elif _LIBCPP_STD_VER <= 14
return wmemcmp(__s1, __s2, __n);
@@ -351,7 +353,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX14
size_t
char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
{
-#if __has_builtin(__builtin_wcslen)
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_wcslen(__s);
#elif _LIBCPP_STD_VER <= 14
return wcslen(__s);
@@ -369,7 +371,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
{
if (__n == 0)
return NULL;
-#if __has_builtin(__builtin_wmemchr)
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_wmemchr(__s, __a, __n);
#elif _LIBCPP_STD_VER <= 14
return wmemchr(__s, __a, __n);