diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -953,10 +953,6 @@ #define _LIBCPP_WCTYPE_IS_MASK #endif -#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) -#define _LIBCPP_NO_HAS_CHAR8_T -#endif - // Deprecation macros. // // Deprecations warnings are always enabled, except when users explicitly opt-out diff --git a/libcxx/include/__string b/libcxx/include/__string --- a/libcxx/include/__string +++ b/libcxx/include/__string @@ -57,6 +57,7 @@ #include // for search and min #include // For EOF. #include // for __murmur2_or_cityhash +#include // for feature-test macros #include <__debug> @@ -579,7 +580,7 @@ } -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) template <> struct _LIBCPP_TEMPLATE_VIS char_traits @@ -686,7 +687,7 @@ return nullptr; } -#endif // #_LIBCPP_NO_HAS_CHAR8_T +#endif // __cpp_lib_char8_t #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS diff --git a/libcxx/include/atomic b/libcxx/include/atomic --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -1127,7 +1127,7 @@ #if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) # define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE # define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) # define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE #endif # define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE @@ -1141,7 +1141,7 @@ #elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE) # define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE # define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) # define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE #endif # define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE @@ -1458,7 +1458,7 @@ template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; }; template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; }; template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; }; -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_CHAR8_T_LOCK_FREE }; }; #endif template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; }; @@ -2732,7 +2732,7 @@ typedef atomic atomic_ulong; typedef atomic atomic_llong; typedef atomic atomic_ullong; -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) typedef atomic atomic_char8_t; #endif typedef atomic atomic_char16_t; diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef --- a/libcxx/include/cstddef +++ b/libcxx/include/cstddef @@ -59,7 +59,7 @@ template <> struct __libcpp_is_integral { enum { value = 1 }; }; template <> struct __libcpp_is_integral { enum { value = 1 }; }; template <> struct __libcpp_is_integral { enum { value = 1 }; }; -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) template <> struct __libcpp_is_integral { enum { value = 1 }; }; #endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd --- a/libcxx/include/iosfwd +++ b/libcxx/include/iosfwd @@ -93,6 +93,7 @@ #include <__config> #include // for mbstate_t +#include // for feature-test macros #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -104,7 +105,7 @@ template struct _LIBCPP_TEMPLATE_VIS char_traits; template<> struct char_traits; -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) template<> struct char_traits; #endif template<> struct char_traits; @@ -188,7 +189,7 @@ template class _LIBCPP_TEMPLATE_VIS fpos; typedef fpos streampos; typedef fpos wstreampos; -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) typedef fpos u8streampos; #endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -4327,7 +4327,7 @@ __lhs.swap(__rhs); } -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) typedef basic_string u8string; #endif @@ -4506,7 +4506,7 @@ return basic_string (__str, __len); } -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) inline _LIBCPP_INLINE_VISIBILITY basic_string operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT { diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -777,7 +777,7 @@ basic_string_view<_CharT, _Traits> __str); typedef basic_string_view string_view; -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) typedef basic_string_view u8string_view; #endif typedef basic_string_view u16string_view; @@ -813,7 +813,7 @@ return basic_string_view (__str, __len); } -#ifndef _LIBCPP_NO_HAS_CHAR8_T +#if defined(__cpp_lib_char8_t) inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR basic_string_view operator "" sv(const char8_t *__str, size_t __len) _NOEXCEPT { diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -249,7 +249,7 @@ # endif // # define __cpp_lib_bind_front 201811L // # define __cpp_lib_bit_cast 201806L -# if !defined(_LIBCPP_NO_HAS_CHAR8_T) +# if defined(__cpp_char8_t) # define __cpp_lib_char8_t 201811L # endif // # define __cpp_lib_concepts 201806L diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -336,7 +336,7 @@ "headers": ["atomic", "filesystem", "istream", "limits", "locale", "ostream", "string", "string_view"], "depends": "defined(__cpp_char8_t)", - "internal_depends": "!defined(_LIBCPP_NO_HAS_CHAR8_T)", + "internal_depends": "defined(__cpp_char8_t)", }, { "name": "__cpp_lib_erase_if", "values": { "c++2a": int(202002) },