diff --git a/libcxx/test/support/constexpr_char_traits.h b/libcxx/test/support/constexpr_char_traits.h --- a/libcxx/test/support/constexpr_char_traits.h +++ b/libcxx/test/support/constexpr_char_traits.h @@ -15,10 +15,10 @@ #include "test_macros.h" -template +template struct constexpr_char_traits { - typedef _CharT char_type; + typedef CharT char_type; typedef int int_type; typedef std::streamoff off_type; typedef std::streampos pos_type; @@ -26,116 +26,116 @@ // The comparison_category is omitted so the class will have weak_ordering // in C++20. This is intentional. - static TEST_CONSTEXPR_CXX14 void assign(char_type& __c1, const char_type& __c2) TEST_NOEXCEPT - {__c1 = __c2;} + static TEST_CONSTEXPR_CXX14 void assign(char_type& c1, const char_type& c2) TEST_NOEXCEPT + {c1 = c2;} - static TEST_CONSTEXPR bool eq(char_type __c1, char_type __c2) TEST_NOEXCEPT - {return __c1 == __c2;} + static TEST_CONSTEXPR bool eq(char_type c1, char_type c2) TEST_NOEXCEPT + {return c1 == c2;} - static TEST_CONSTEXPR bool lt(char_type __c1, char_type __c2) TEST_NOEXCEPT - {return __c1 < __c2;} + static TEST_CONSTEXPR bool lt(char_type c1, char_type c2) TEST_NOEXCEPT + {return c1 < c2;} - static TEST_CONSTEXPR_CXX14 int compare(const char_type* __s1, const char_type* __s2, size_t __n); - static TEST_CONSTEXPR_CXX14 size_t length(const char_type* __s); - static TEST_CONSTEXPR_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a); - static TEST_CONSTEXPR_CXX14 char_type* move(char_type* __s1, const char_type* __s2, size_t __n); - static TEST_CONSTEXPR_CXX14 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); - static TEST_CONSTEXPR_CXX14 char_type* assign(char_type* __s, size_t __n, char_type __a); + static TEST_CONSTEXPR_CXX14 int compare(const char_type* s1, const char_type* s2, size_t n); + static TEST_CONSTEXPR_CXX14 size_t length(const char_type* s); + static TEST_CONSTEXPR_CXX14 const char_type* find(const char_type* s, size_t n, const char_type& a); + static TEST_CONSTEXPR_CXX14 char_type* move(char_type* s1, const char_type* s2, size_t n); + static TEST_CONSTEXPR_CXX14 char_type* copy(char_type* s1, const char_type* s2, size_t n); + static TEST_CONSTEXPR_CXX14 char_type* assign(char_type* s, size_t n, char_type a); - static TEST_CONSTEXPR int_type not_eof(int_type __c) TEST_NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static TEST_CONSTEXPR int_type not_eof(int_type c) TEST_NOEXCEPT + {return eq_int_type(c, eof()) ? ~eof() : c;} - static TEST_CONSTEXPR char_type to_char_type(int_type __c) TEST_NOEXCEPT - {return char_type(__c);} + static TEST_CONSTEXPR char_type to_char_type(int_type c) TEST_NOEXCEPT + {return char_type(c);} - static TEST_CONSTEXPR int_type to_int_type(char_type __c) TEST_NOEXCEPT - {return int_type(__c);} + static TEST_CONSTEXPR int_type to_int_type(char_type c) TEST_NOEXCEPT + {return int_type(c);} - static TEST_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) TEST_NOEXCEPT - {return __c1 == __c2;} + static TEST_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) TEST_NOEXCEPT + {return c1 == c2;} static TEST_CONSTEXPR int_type eof() TEST_NOEXCEPT {return int_type(EOF);} }; -template +template TEST_CONSTEXPR_CXX14 int -constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) +constexpr_char_traits::compare(const char_type* s1, const char_type* s2, size_t n) { - for (; __n; --__n, ++__s1, ++__s2) + for (; n; --n, ++s1, ++s2) { - if (lt(*__s1, *__s2)) + if (lt(*s1, *s2)) return -1; - if (lt(*__s2, *__s1)) + if (lt(*s2, *s1)) return 1; } return 0; } -template +template TEST_CONSTEXPR_CXX14 size_t -constexpr_char_traits<_CharT>::length(const char_type* __s) +constexpr_char_traits::length(const char_type* s) { - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; + size_t len = 0; + for (; !eq(*s, char_type(0)); ++s) + ++len; + return len; } -template -TEST_CONSTEXPR_CXX14 const _CharT* -constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) +template +TEST_CONSTEXPR_CXX14 const CharT* +constexpr_char_traits::find(const char_type* s, size_t n, const char_type& a) { - for (; __n; --__n) + for (; n; --n) { - if (eq(*__s, __a)) - return __s; - ++__s; + if (eq(*s, a)) + return s; + ++s; } return 0; } -template -TEST_CONSTEXPR_CXX14 _CharT* -constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) +template +TEST_CONSTEXPR_CXX14 CharT* +constexpr_char_traits::move(char_type* s1, const char_type* s2, size_t n) { - char_type* __r = __s1; - if (__s1 < __s2) + char_type* r = s1; + if (s1 < s2) { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); + for (; n; --n, ++s1, ++s2) + assign(*s1, *s2); } - else if (__s2 < __s1) + else if (s2 < s1) { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); + s1 += n; + s2 += n; + for (; n; --n) + assign(*--s1, *--s2); } - return __r; + return r; } -template -TEST_CONSTEXPR_CXX14 _CharT* -constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) +template +TEST_CONSTEXPR_CXX14 CharT* +constexpr_char_traits::copy(char_type* s1, const char_type* s2, size_t n) { if (!TEST_IS_CONSTANT_EVALUATED) // fails in constexpr because we might be comparing unrelated pointers - assert(__s2 < __s1 || __s2 >= __s1+__n); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; + assert(s2 < s1 || s2 >= s1+n); + char_type* r = s1; + for (; n; --n, ++s1, ++s2) + assign(*s1, *s2); + return r; } -template -TEST_CONSTEXPR_CXX14 _CharT* -constexpr_char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) +template +TEST_CONSTEXPR_CXX14 CharT* +constexpr_char_traits::assign(char_type* s, size_t n, char_type a) { - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; + char_type* r = s; + for (; n; --n, ++s) + assign(*s, a); + return r; } #endif // _CONSTEXPR_CHAR_TRAITS