[libcxx] r291742 - disable use of __builtin_memcmp temporarily to get the tests passing again
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 11 21:40:58 PST 2017
Author: marshall
Date: Wed Jan 11 23:40:58 2017
New Revision: 291742
URL: http://llvm.org/viewvc/llvm-project?rev=291742&view=rev
Log:
disable use of __builtin_memcmp temporarily to get the tests passing again
Modified:
libcxx/trunk/include/__string
Modified: libcxx/trunk/include/__string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__string?rev=291742&r1=291741&r2=291742&view=diff
==============================================================================
--- libcxx/trunk/include/__string (original)
+++ libcxx/trunk/include/__string Wed Jan 11 23:40:58 2017
@@ -209,9 +209,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return (unsigned char)__c1 < (unsigned char)__c2;}
- static inline _LIBCPP_CONSTEXPR_AFTER_CXX14
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
- {return __n == 0 ? 0 : __builtin_memcmp(__s1, __s2, __n);}
+ static _LIBCPP_CONSTEXPR_AFTER_CXX14
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14
length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
static _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -239,6 +238,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<
};
inline _LIBCPP_CONSTEXPR_AFTER_CXX14
+int
+char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
+{
+ if (__n == 0)
+ return 0;
+#ifdef _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR
+ return __builtin_memcmp(__s1, __s2, __n);
+#elif _LIBCPP_STD_VER <= 14
+ return memcmp(__s1, __s2, __n);
+#else
+ for (; __n; --__n, ++__s1, ++__s2)
+ {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
+ }
+ return 0;
+#endif
+}
+
+inline _LIBCPP_CONSTEXPR_AFTER_CXX14
const char*
char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
{
More information about the cfe-commits
mailing list