From 8c58e4d2525bf2ee3d48679fc95df9686dab7235 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sun, 24 Oct 2021 21:14:00 +0800 Subject: [PATCH] libc++: Guard C++20 atomic type aliases https://reviews.llvm.org/D75183 https://github.com/ziglang/zig/issues/6573 --- src/buildtools/third_party/libc++/trunk/include/atomic | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/buildtools/third_party/libc++/trunk/include/atomic b/src/buildtools/third_party/libc++/trunk/include/atomic index 5ab10da5ff..ffe0e9a4ea 100644 --- a/src/buildtools/third_party/libc++/trunk/include/atomic +++ b/src/buildtools/third_party/libc++/trunk/include/atomic @@ -2777,6 +2777,8 @@ typedef atomic 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}