[libcxx-commits] [libcxx] c0f87e8 - [libc++] Remove _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 17 08:00:08 PST 2021
Author: Louis Dionne
Date: 2021-11-17T10:59:57-05:00
New Revision: c0f87e83820b73610e9352a46f0c386d6aa91767
URL: https://github.com/llvm/llvm-project/commit/c0f87e83820b73610e9352a46f0c386d6aa91767
DIFF: https://github.com/llvm/llvm-project/commit/c0f87e83820b73610e9352a46f0c386d6aa91767.diff
LOG: [libc++] Remove _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
All supported compilers support spaceship in C++20 nowadays.
Differential Revision: https://reviews.llvm.org/D113938
Added:
Modified:
libcxx/include/__compare/common_comparison_category.h
libcxx/include/__compare/compare_three_way.h
libcxx/include/__compare/ordering.h
libcxx/include/__compare/synth_three_way.h
libcxx/include/__compare/three_way_comparable.h
libcxx/include/__config
libcxx/include/__coroutine/coroutine_handle.h
libcxx/include/__ranges/transform_view.h
libcxx/include/__utility/pair.h
libcxx/include/compare
libcxx/include/tuple
Removed:
################################################################################
diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index 09afb06243e7d..37a28db1d650a 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
+#if _LIBCPP_STD_VER > 17
namespace __comp_detail {
@@ -87,7 +87,7 @@ struct _LIBCPP_TEMPLATE_VIS common_comparison_category {
template<class... _Ts>
using common_comparison_category_t = typename common_comparison_category<_Ts...>::type;
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
+#endif // _LIBCPP_STD_VER > 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__compare/compare_three_way.h b/libcxx/include/__compare/compare_three_way.h
index 492908a3a0dfc..3edddf1a1c94a 100644
--- a/libcxx/include/__compare/compare_three_way.h
+++ b/libcxx/include/__compare/compare_three_way.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
struct _LIBCPP_TEMPLATE_VIS compare_three_way
{
@@ -34,7 +34,7 @@ struct _LIBCPP_TEMPLATE_VIS compare_three_way
using is_transparent = void;
};
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__compare/ordering.h b/libcxx/include/__compare/ordering.h
index b250c16ccbb93..d4087bc85ba18 100644
--- a/libcxx/include/__compare/ordering.h
+++ b/libcxx/include/__compare/ordering.h
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
+#if _LIBCPP_STD_VER > 17
// exposition only
enum class _LIBCPP_ENUM_VIS _OrdResult : signed char {
@@ -312,7 +312,7 @@ inline constexpr strong_ordering strong_ordering::equal(_OrdResult::__equiv);
inline constexpr strong_ordering strong_ordering::equivalent(_OrdResult::__equiv);
inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater);
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
+#endif // _LIBCPP_STD_VER > 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__compare/synth_three_way.h b/libcxx/include/__compare/synth_three_way.h
index cc0b0f2c2aff6..3d8e738816dd9 100644
--- a/libcxx/include/__compare/synth_three_way.h
+++ b/libcxx/include/__compare/synth_three_way.h
@@ -21,7 +21,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
// [expos.only.func]
@@ -44,7 +44,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way =
template <class _Tp, class _Up = _Tp>
using __synth_three_way_result = decltype(__synth_three_way(declval<_Tp&>(), declval<_Up&>()));
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__compare/three_way_comparable.h b/libcxx/include/__compare/three_way_comparable.h
index 2560cf640241e..c4794949007ba 100644
--- a/libcxx/include/__compare/three_way_comparable.h
+++ b/libcxx/include/__compare/three_way_comparable.h
@@ -24,7 +24,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
template<class _Tp, class _Cat>
concept __compares_as =
@@ -51,7 +51,7 @@ concept three_way_comparable_with =
{ __u <=> __t } -> __compares_as<_Cat>;
};
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 90c0631089627..c09d5f3b1dab2 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1306,10 +1306,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_CXX20_COROUTINES
#endif
-#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201907L
-#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
-#endif
-
#if defined(_LIBCPP_COMPILER_IBM)
#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
#endif
diff --git a/libcxx/include/__coroutine/coroutine_handle.h b/libcxx/include/__coroutine/coroutine_handle.h
index bddd45e72e21a..64657c0585b90 100644
--- a/libcxx/include/__coroutine/coroutine_handle.h
+++ b/libcxx/include/__coroutine/coroutine_handle.h
@@ -94,31 +94,6 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
};
// [coroutine.handle.compare]
-#if defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
-
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return __x.address() == __y.address();
-}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return less<void*>()(__x.address(), __y.address());
-}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return __y < __x;
-}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return !(__x > __y);
-}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return !(__x < __y);
-}
-
-#else
-
inline _LIBCPP_HIDE_FROM_ABI
constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
return __x.address() == __y.address();
@@ -128,8 +103,6 @@ constexpr strong_ordering operator<=>(coroutine_handle<> __x, coroutine_handle<>
return compare_three_way()(__x.address(), __y.address());
}
-#endif // defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
-
template <class _Promise>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
public:
diff --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h
index de1296cbd260d..208a9a22694a7 100644
--- a/libcxx/include/__ranges/transform_view.h
+++ b/libcxx/include/__ranges/transform_view.h
@@ -303,14 +303,12 @@ class transform_view<_View, _Fn>::__iterator
return __x.__current_ >= __y.__current_;
}
-#if !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
_LIBCPP_HIDE_FROM_ABI
friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
{
return __x.__current_ <=> __y.__current_;
}
-#endif // !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
_LIBCPP_HIDE_FROM_ABI
friend constexpr __iterator operator+(__iterator __i,
diff erence_type __n)
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 959a8db5b3ecc..f1114696884ac 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -330,7 +330,7 @@ operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
return __x.first == __y.first && __x.second == __y.second;
}
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
template <class _T1, class _T2>
_LIBCPP_HIDE_FROM_ABI constexpr
@@ -345,7 +345,7 @@ operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
return _VSTD::__synth_three_way(__x.second, __y.second);
}
-#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -387,7 +387,7 @@ operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
return !(__y < __x);
}
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
diff --git a/libcxx/include/compare b/libcxx/include/compare
index ddb8313547512..ad658c9b7beca 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -149,7 +149,7 @@ namespace std {
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
+#if _LIBCPP_STD_VER > 17
// [cmp.alg], comparison algorithms
// TODO: unimplemented
@@ -157,7 +157,7 @@ template<class _Tp> constexpr strong_ordering strong_order(const _Tp& __lhs, con
template<class _Tp> constexpr weak_ordering weak_order(const _Tp& __lhs, const _Tp& __rhs);
template<class _Tp> constexpr partial_ordering partial_order(const _Tp& __lhs, const _Tp& __rhs);
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR)
+#endif // _LIBCPP_STD_VER > 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 50d31149ee099..1e671b909d8eb 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -1306,7 +1306,7 @@ operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
}
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
// operator<=>
@@ -1328,7 +1328,7 @@ operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
return _VSTD::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
}
-#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -1398,7 +1398,7 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
return !(__y < __x);
}
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
// tuple_cat
More information about the libcxx-commits
mailing list