libc++: Guard C++20 atomic type aliases

https://reviews.llvm.org/D75183
https://github.com/ziglang/zig/issues/6573
This commit is contained in:
klzgrad 2021-10-24 21:14:00 +08:00
parent a826b00930
commit 8c58e4d252

View File

@ -2777,6 +2777,8 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
# define _LIBCPP_CONTENTION_LOCK_FREE false # define _LIBCPP_CONTENTION_LOCK_FREE false
#endif #endif
#if _LIBCPP_STD_VER > 17
#if ATOMIC_LLONG_LOCK_FREE == 2 #if ATOMIC_LLONG_LOCK_FREE == 2
typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long>::type __libcpp_signed_lock_free; typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long>::type __libcpp_signed_lock_free;
typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long>::type __libcpp_unsigned_lock_free; typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long>::type __libcpp_unsigned_lock_free;
@ -2791,10 +2793,15 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ
typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free; typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free;
#else #else
// No signed/unsigned lock-free types // No signed/unsigned lock-free types
# define _LIBCPP_CANNOT_DEFINE_ATOMIC_LOCK_FREE_TYPE_ALIASES
#endif #endif
#ifndef _LIBCPP_CANNOT_DEFINE_ATOMIC_LOCK_FREE_TYPE_ALIASES
typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free; typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free;
typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free; typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free;
#endif
#endif // _LIBCPP_STD_VER > 17
#define ATOMIC_FLAG_INIT {false} #define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v} #define ATOMIC_VAR_INIT(__v) {__v}