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 16081ab27e
commit 0874b1ed2b

View File

@ -2777,6 +2777,8 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
# define _LIBCPP_CONTENTION_LOCK_FREE false
#endif
#if _LIBCPP_STD_VER > 17
#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, 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;
#else
// No signed/unsigned lock-free types
# define _LIBCPP_CANNOT_DEFINE_ATOMIC_LOCK_FREE_TYPE_ALIASES
#endif
#ifndef _LIBCPP_CANNOT_DEFINE_ATOMIC_LOCK_FREE_TYPE_ALIASES
typedef atomic<__libcpp_signed_lock_free> atomic_signed_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_VAR_INIT(__v) {__v}