public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip
@ 2024-01-17  2:40 Patrick Palka
  2024-01-17  2:40 ` [PATCH 2/2] libstdc++/pair: Guard P2321R2 changes with __glibcxx_ranges_zip Patrick Palka
  2024-01-17  7:43 ` [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip Jonathan Wakely
  0 siblings, 2 replies; 4+ messages in thread
From: Patrick Palka @ 2024-01-17  2:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

Guard <tuple> additions from P2321R2 zip with __cpp_lib_ranges_zip
instead of __cplusplus > 202020L.

libstdc++-v3/ChangeLog:

	* include/std/tuple [__cplusplus > 202002L]: Guard P2321R2
	changes with __cpp_lib_ranges_zip instead.
---
 libstdc++-v3/include/std/tuple | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 2f6e419ea5b..7a045b3e6a1 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -324,7 +324,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
 	{ }
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       template<typename... _UElements>
 	constexpr
 	_Tuple_impl(_Tuple_impl<_Idx, _UElements...>& __in)
@@ -405,7 +405,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
 	{ }
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       template<typename _Alloc, typename _UHead, typename... _UTails>
 	constexpr
 	_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
@@ -449,7 +449,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	      std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
 	}
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       template<typename... _UElements>
 	constexpr void
 	_M_assign(const _Tuple_impl<_Idx, _UElements...>& __in) const
@@ -480,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	_Inherited::_M_swap(_M_tail(__in));
       }
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       constexpr void
       _M_swap(const _Tuple_impl& __in) const
       {
@@ -549,7 +549,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	: _Base(std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
 	{ }
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       template<typename _UHead>
 	constexpr
 	_Tuple_impl(_Tuple_impl<_Idx, _UHead>& __in)
@@ -615,7 +615,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
 	{ }
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       template<typename _Alloc, typename _UHead>
 	constexpr
 	_Tuple_impl(allocator_arg_t, const _Alloc& __a,
@@ -650,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	    = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in));
 	}
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       template<typename _UHead>
 	constexpr void
 	_M_assign(const _Tuple_impl<_Idx, _UHead>& __in) const
@@ -676,7 +676,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	swap(_M_head(*this), _M_head(__in));
       }
 
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       constexpr void
       _M_swap(const _Tuple_impl& __in) const
       {
@@ -1775,7 +1775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     public:
       _GLIBCXX20_CONSTEXPR
       void swap(tuple&) noexcept { /* no-op */ }
-#if __cplusplus > 202002L
+#if __cpp_lib_ranges_zip // >= C++23
       constexpr void swap(const tuple&) const noexcept { /* no-op */ }
 #endif
       // We need the default since we're going to define no-op
-- 
2.43.0.367.g186b115d30


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] libstdc++/pair: Guard P2321R2 changes with __glibcxx_ranges_zip
  2024-01-17  2:40 [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip Patrick Palka
@ 2024-01-17  2:40 ` Patrick Palka
  2024-01-17  7:43   ` Jonathan Wakely
  2024-01-17  7:43 ` [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip Jonathan Wakely
  1 sibling, 1 reply; 4+ messages in thread
From: Patrick Palka @ 2024-01-17  2:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

Similar to the previous change for <tuple>, but since stl_pair.h is an
internal header we need to use the corresponding internal macro instead.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h [__cplusplus > 202002L]:
	Guard P2321R2 changes with __glibcxx_ranges_zip instead.
---
 libstdc++-v3/include/bits/stl_pair.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 52f532f3c39..acd0c7b58f9 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -211,7 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	swap(second, __p.second);
       }
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_zip // >= C++23
       // As an extension, we constrain the const swap member function in order
       // to continue accepting explicit instantiation of pairs whose elements
       // are not all const swappable.  Without this constraint, such an
@@ -360,7 +360,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	constexpr explicit(!_S_convertible<_U1, _U2>())
 	pair(pair<_U1, _U2>&&) = delete;
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_zip // >= C++23
       /// Converting constructor from a non-const `pair<U1, U2>` lvalue
       template<typename _U1, typename _U2>
 	requires (_S_constructible<_U1&, _U2&>()) && (!_S_dangles<_U1&, _U2&>())
@@ -464,7 +464,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  return *this;
 	}
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_zip // >= C++23
       /// Copy assignment operator (const)
       constexpr const pair&
       operator=(const pair& __p) const
@@ -887,7 +887,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     noexcept(noexcept(__x.swap(__y)))
     { __x.swap(__y); }
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_zip // >= C++23
   template<typename _T1, typename _T2>
     requires is_swappable_v<const _T1> && is_swappable_v<const _T2>
     constexpr void
@@ -1101,7 +1101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif // __glibcxx_tuples_by_type
 
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_zip // >= C++23
   template<typename _T1, typename _T2, typename _U1, typename _U2,
 	   template<typename> class _TQual, template<typename> class _UQual>
     requires requires { typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
-- 
2.43.0.367.g186b115d30


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip
  2024-01-17  2:40 [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip Patrick Palka
  2024-01-17  2:40 ` [PATCH 2/2] libstdc++/pair: Guard P2321R2 changes with __glibcxx_ranges_zip Patrick Palka
@ 2024-01-17  7:43 ` Jonathan Wakely
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2024-01-17  7:43 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches, libstdc++

On Wed, 17 Jan 2024 at 02:40, Patrick Palka wrote:
>
> Guard <tuple> additions from P2321R2 zip with __cpp_lib_ranges_zip
> instead of __cplusplus > 202020L.

Ah yes, I should have changed all of these in r14-7225-gf8a5298c97c460

OK for trunk, thanks.


>
> libstdc++-v3/ChangeLog:
>
>         * include/std/tuple [__cplusplus > 202002L]: Guard P2321R2
>         changes with __cpp_lib_ranges_zip instead.
> ---
>  libstdc++-v3/include/std/tuple | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
> index 2f6e419ea5b..7a045b3e6a1 100644
> --- a/libstdc++-v3/include/std/tuple
> +++ b/libstdc++-v3/include/std/tuple
> @@ -324,7 +324,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>                 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
>         { }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        template<typename... _UElements>
>         constexpr
>         _Tuple_impl(_Tuple_impl<_Idx, _UElements...>& __in)
> @@ -405,7 +405,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>                 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
>         { }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        template<typename _Alloc, typename _UHead, typename... _UTails>
>         constexpr
>         _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
> @@ -449,7 +449,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>               std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
>         }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        template<typename... _UElements>
>         constexpr void
>         _M_assign(const _Tuple_impl<_Idx, _UElements...>& __in) const
> @@ -480,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         _Inherited::_M_swap(_M_tail(__in));
>        }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        constexpr void
>        _M_swap(const _Tuple_impl& __in) const
>        {
> @@ -549,7 +549,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         : _Base(std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
>         { }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        template<typename _UHead>
>         constexpr
>         _Tuple_impl(_Tuple_impl<_Idx, _UHead>& __in)
> @@ -615,7 +615,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>                 std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
>         { }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        template<typename _Alloc, typename _UHead>
>         constexpr
>         _Tuple_impl(allocator_arg_t, const _Alloc& __a,
> @@ -650,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>             = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in));
>         }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        template<typename _UHead>
>         constexpr void
>         _M_assign(const _Tuple_impl<_Idx, _UHead>& __in) const
> @@ -676,7 +676,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         swap(_M_head(*this), _M_head(__in));
>        }
>
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        constexpr void
>        _M_swap(const _Tuple_impl& __in) const
>        {
> @@ -1775,7 +1775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      public:
>        _GLIBCXX20_CONSTEXPR
>        void swap(tuple&) noexcept { /* no-op */ }
> -#if __cplusplus > 202002L
> +#if __cpp_lib_ranges_zip // >= C++23
>        constexpr void swap(const tuple&) const noexcept { /* no-op */ }
>  #endif
>        // We need the default since we're going to define no-op
> --
> 2.43.0.367.g186b115d30
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] libstdc++/pair: Guard P2321R2 changes with __glibcxx_ranges_zip
  2024-01-17  2:40 ` [PATCH 2/2] libstdc++/pair: Guard P2321R2 changes with __glibcxx_ranges_zip Patrick Palka
@ 2024-01-17  7:43   ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2024-01-17  7:43 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches, libstdc++

On Wed, 17 Jan 2024 at 02:41, Patrick Palka wrote:
>
> Similar to the previous change for <tuple>, but since stl_pair.h is an
> internal header we need to use the corresponding internal macro instead.

OK thanks.


>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/stl_pair.h [__cplusplus > 202002L]:
>         Guard P2321R2 changes with __glibcxx_ranges_zip instead.
> ---
>  libstdc++-v3/include/bits/stl_pair.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
> index 52f532f3c39..acd0c7b58f9 100644
> --- a/libstdc++-v3/include/bits/stl_pair.h
> +++ b/libstdc++-v3/include/bits/stl_pair.h
> @@ -211,7 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         swap(second, __p.second);
>        }
>
> -#if __cplusplus > 202002L
> +#if __glibcxx_ranges_zip // >= C++23
>        // As an extension, we constrain the const swap member function in order
>        // to continue accepting explicit instantiation of pairs whose elements
>        // are not all const swappable.  Without this constraint, such an
> @@ -360,7 +360,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         constexpr explicit(!_S_convertible<_U1, _U2>())
>         pair(pair<_U1, _U2>&&) = delete;
>
> -#if __cplusplus > 202002L
> +#if __glibcxx_ranges_zip // >= C++23
>        /// Converting constructor from a non-const `pair<U1, U2>` lvalue
>        template<typename _U1, typename _U2>
>         requires (_S_constructible<_U1&, _U2&>()) && (!_S_dangles<_U1&, _U2&>())
> @@ -464,7 +464,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>           return *this;
>         }
>
> -#if __cplusplus > 202002L
> +#if __glibcxx_ranges_zip // >= C++23
>        /// Copy assignment operator (const)
>        constexpr const pair&
>        operator=(const pair& __p) const
> @@ -887,7 +887,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      noexcept(noexcept(__x.swap(__y)))
>      { __x.swap(__y); }
>
> -#if __cplusplus > 202002L
> +#if __glibcxx_ranges_zip // >= C++23
>    template<typename _T1, typename _T2>
>      requires is_swappable_v<const _T1> && is_swappable_v<const _T2>
>      constexpr void
> @@ -1101,7 +1101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>  #endif // __glibcxx_tuples_by_type
>
>
> -#if __cplusplus > 202002L
> +#if __glibcxx_ranges_zip // >= C++23
>    template<typename _T1, typename _T2, typename _U1, typename _U2,
>            template<typename> class _TQual, template<typename> class _UQual>
>      requires requires { typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
> --
> 2.43.0.367.g186b115d30
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-17  7:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17  2:40 [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip Patrick Palka
2024-01-17  2:40 ` [PATCH 2/2] libstdc++/pair: Guard P2321R2 changes with __glibcxx_ranges_zip Patrick Palka
2024-01-17  7:43   ` Jonathan Wakely
2024-01-17  7:43 ` [PATCH 1/2] libstdc++/tuple: Guard P2321R2 changes with __cpp_lib_ranges_zip Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).