Revert "Update aosp/master libcxx rebase to r263688"
The world is burning.
This reverts commit c004fd909c006eec55077c52ee119e1fa338c9e9, reversing
changes made to 1418e4163da4bb0b9e3fe496e51c23a0dce399d9.
diff --git a/include/atomic b/include/atomic
index a0245eb..97a998d 100644
--- a/include/atomic
+++ b/include/atomic
@@ -17,10 +17,6 @@
namespace std
{
-// feature test macro
-
-#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10
-
// order and consistency
typedef enum memory_order
@@ -93,7 +89,6 @@
template <class T>
struct atomic
{
- static constexpr bool is_always_lock_free;
bool is_lock_free() const volatile noexcept;
bool is_lock_free() const noexcept;
void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
@@ -132,7 +127,6 @@
template <>
struct atomic<integral>
{
- static constexpr bool is_always_lock_free;
bool is_lock_free() const volatile noexcept;
bool is_lock_free() const noexcept;
void store(integral desr, memory_order m = memory_order_seq_cst) volatile noexcept;
@@ -208,7 +202,6 @@
template <class T>
struct atomic<T*>
{
- static constexpr bool is_always_lock_free;
bool is_lock_free() const volatile noexcept;
bool is_lock_free() const noexcept;
void store(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept;
@@ -542,40 +535,25 @@
#ifdef _LIBCPP_HAS_NO_THREADS
#error <atomic> is not supported on this single threaded system
-#endif
-#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
-#error <atomic> is not implemented
-#endif
-
-#if _LIBCPP_STD_VER > 14
-// FIXME: use the right feature test macro value as chose by SG10.
-# define __cpp_lib_atomic_is_always_lock_free 201603L
-#endif
+#else // !_LIBCPP_HAS_NO_THREADS
_LIBCPP_BEGIN_NAMESPACE_STD
+#if !__has_feature(cxx_atomic) && _GNUC_VER < 407
+#error <atomic> is not implemented
+#else
+
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;
-#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
+#if _GNUC_VER >= 407
namespace __gcc_atomic {
template <typename _Tp>
struct __gcc_atomic_t {
-
-#if _GNUC_VER >= 501
- static_assert(is_trivially_copyable<_Tp>::value,
- "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
- __gcc_atomic_t() _NOEXCEPT = default;
-#else
- __gcc_atomic_t() _NOEXCEPT : __a_value() {}
-#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+ __gcc_atomic_t() _NOEXCEPT {}
_LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
: __a_value(value) {}
_Tp __a_value;
@@ -596,7 +574,7 @@
sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
};
-static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
+static inline constexpr int __to_gcc_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -606,7 +584,7 @@
__ATOMIC_CONSUME))));
}
-static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
+static inline constexpr int __to_gcc_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -827,7 +805,7 @@
return __atomic_fetch_xor(&__a->__a_value, __pattern,
__gcc_atomic::__to_gcc_order(__order));
}
-#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
+#endif // _GNUC_VER >= 407
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -837,17 +815,6 @@
return __y;
}
-#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
-#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
-#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
-#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
-#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
-#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
-#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
-#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
-
// general atomic<T>
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
@@ -855,14 +822,10 @@
{
mutable _Atomic(_Tp) __a_;
-#if defined(__cpp_lib_atomic_is_always_lock_free)
- static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0);
-#endif
-
_LIBCPP_INLINE_VISIBILITY
bool is_lock_free() const volatile _NOEXCEPT
{
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
+#if __has_feature(cxx_atomic)
return __c11_atomic_is_lock_free(sizeof(_Tp));
#else
return __atomic_is_lock_free(sizeof(_Tp), 0);
@@ -947,11 +910,6 @@
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
};
-#if defined(__cpp_lib_atomic_is_always_lock_free)
-template <class _Tp, bool __b>
-_LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free;
-#endif
-
// atomic<Integral>
template <class _Tp>
@@ -1689,7 +1647,7 @@
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
- atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
+ atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {}
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
atomic_flag(const atomic_flag&) = delete;
@@ -1821,6 +1779,23 @@
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v}
+// lock-free property
+
+#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
+#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
+#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
+#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
+#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
+#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
+#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
+
+#endif // !__has_feature(cxx_atomic)
+
_LIBCPP_END_NAMESPACE_STD
+#endif // !_LIBCPP_HAS_NO_THREADS
+
#endif // _LIBCPP_ATOMIC