diff --git a/libcxx/include/atomic b/libcxx/include/atomic --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -48,6 +48,7 @@ #define ATOMIC_BOOL_LOCK_FREE unspecified #define ATOMIC_CHAR_LOCK_FREE unspecified +#define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20 #define ATOMIC_CHAR16_T_LOCK_FREE unspecified #define ATOMIC_CHAR32_T_LOCK_FREE unspecified #define ATOMIC_WCHAR_T_LOCK_FREE unspecified @@ -465,6 +466,7 @@ typedef atomic atomic_ulong; typedef atomic atomic_llong; typedef atomic atomic_ullong; +typedef atomic atomic_char8_t; // C++20 typedef atomic atomic_char16_t; typedef atomic atomic_char32_t; typedef atomic atomic_wchar_t; @@ -1125,6 +1127,9 @@ #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 +# 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 # define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE # define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE @@ -1136,6 +1141,9 @@ #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 +# 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 # define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE # define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE @@ -1450,6 +1458,9 @@ 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 +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 }; }; template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; }; template<> struct __cxx_is_always_lock_free { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; }; @@ -2721,6 +2732,9 @@ typedef atomic atomic_ulong; typedef atomic atomic_llong; typedef atomic atomic_ullong; +#ifndef _LIBCPP_NO_HAS_CHAR8_T +typedef atomic atomic_char8_t; +#endif typedef atomic atomic_char16_t; typedef atomic atomic_char32_t; typedef atomic atomic_wchar_t; diff --git a/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp --- a/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp +++ b/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp @@ -74,6 +74,9 @@ CHECK_ALWAYS_LOCK_FREE(char); CHECK_ALWAYS_LOCK_FREE(signed char); CHECK_ALWAYS_LOCK_FREE(unsigned char); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + CHECK_ALWAYS_LOCK_FREE(char8_t); +#endif CHECK_ALWAYS_LOCK_FREE(char16_t); CHECK_ALWAYS_LOCK_FREE(char32_t); CHECK_ALWAYS_LOCK_FREE(wchar_t); @@ -122,6 +125,9 @@ static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR8_T_LOCK_FREE), ""); +#endif static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE), ""); static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE), ""); static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE), ""); diff --git a/libcxx/test/std/atomics/atomics.lockfree/lockfree.pass.cpp b/libcxx/test/std/atomics/atomics.lockfree/lockfree.pass.cpp --- a/libcxx/test/std/atomics/atomics.lockfree/lockfree.pass.cpp +++ b/libcxx/test/std/atomics/atomics.lockfree/lockfree.pass.cpp @@ -12,6 +12,7 @@ // #define ATOMIC_BOOL_LOCK_FREE unspecified // #define ATOMIC_CHAR_LOCK_FREE unspecified +// #define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20 // #define ATOMIC_CHAR16_T_LOCK_FREE unspecified // #define ATOMIC_CHAR32_T_LOCK_FREE unspecified // #define ATOMIC_WCHAR_T_LOCK_FREE unspecified @@ -34,6 +35,11 @@ assert(ATOMIC_CHAR_LOCK_FREE == 0 || ATOMIC_CHAR_LOCK_FREE == 1 || ATOMIC_CHAR_LOCK_FREE == 2); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + assert(ATOMIC_CHAR8_T_LOCK_FREE == 0 || + ATOMIC_CHAR8_T_LOCK_FREE == 1 || + ATOMIC_CHAR8_T_LOCK_FREE == 2); +#endif assert(ATOMIC_CHAR16_T_LOCK_FREE == 0 || ATOMIC_CHAR16_T_LOCK_FREE == 1 || ATOMIC_CHAR16_T_LOCK_FREE == 2); diff --git a/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp --- a/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp @@ -180,6 +180,9 @@ test(); test(); test(); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + test(); +#endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS test(); test(); diff --git a/libcxx/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp --- a/libcxx/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp @@ -21,6 +21,7 @@ // typedef atomic atomic_ulong; // typedef atomic atomic_llong; // typedef atomic atomic_ullong; +// typedef atomic atomic_char8_t; // C++20 // typedef atomic atomic_char16_t; // typedef atomic atomic_char32_t; // typedef atomic atomic_wchar_t; @@ -56,6 +57,9 @@ static_assert((std::is_same, std::atomic_llong>::value), ""); static_assert((std::is_same, std::atomic_ullong>::value), ""); static_assert((std::is_same, std::atomic_wchar_t>::value), ""); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + static_assert((std::is_same, std::atomic_char8_t>::value), ""); +#endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS static_assert((std::is_same, std::atomic_char16_t>::value), ""); static_assert((std::is_same, std::atomic_char32_t>::value), ""); diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h --- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h +++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h @@ -83,6 +83,9 @@ TestFunctor()(); TestFunctor()(); TestFunctor(); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + TestFunctor()(); +#endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS TestFunctor()(); TestFunctor()(); diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -112,6 +112,9 @@ test (); test (); test (); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + test (); +#endif test (); test (); test ();