* [PATCH] libstdc++ Use _GLIBCXX_USE_BUILTIN_TRAIT
@ 2023-09-11 15:27 Ken Matsui
2023-09-11 15:50 ` Patrick Palka
2023-12-23 23:05 ` [PATCH v2] libstdc++: " Ken Matsui
0 siblings, 2 replies; 6+ messages in thread
From: Ken Matsui @ 2023-09-11 15:27 UTC (permalink / raw)
To: gcc-patches; +Cc: libstdc++, Ken Matsui
This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin in
the type_traits header for traits that have a corresponding fallback
non-built-in implementation. This macro supports to toggle the use of built-in
traits in the type_traits header through _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS
macro, without needing to modify the source code.
libstdc++-v3/ChangeLog:
* include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
libstdc++-v3/include/std/type_traits | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 677cd934b94..221c809dd6d 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1430,7 +1430,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __bool_constant<__is_base_of(_Base, _Derived)>
{ };
-#if __has_builtin(__is_convertible)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
template<typename _From, typename _To>
struct is_convertible
: public __bool_constant<__is_convertible(_From, _To)>
@@ -1480,7 +1480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
-#if __has_builtin(__is_nothrow_convertible)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
/// is_nothrow_convertible_v
template<typename _From, typename _To>
inline constexpr bool is_nothrow_convertible_v
@@ -1555,7 +1555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ using type = _Tp; };
/// remove_cv
-#if __has_builtin(__remove_cv)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
template<typename _Tp>
struct remove_cv
{ using type = __remove_cv(_Tp); };
@@ -1621,7 +1621,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Reference transformations.
/// remove_reference
-#if __has_builtin(__remove_reference)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
template<typename _Tp>
struct remove_reference
{ using type = __remove_reference(_Tp); };
@@ -3427,7 +3427,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
* @{
*/
#ifdef __cpp_lib_remove_cvref // C++ >= 20
-# if __has_builtin(__remove_cvref)
+# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
template<typename _Tp>
struct remove_cvref
{ using type = __remove_cvref(_Tp); };
--
2.42.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libstdc++ Use _GLIBCXX_USE_BUILTIN_TRAIT
2023-09-11 15:27 [PATCH] libstdc++ Use _GLIBCXX_USE_BUILTIN_TRAIT Ken Matsui
@ 2023-09-11 15:50 ` Patrick Palka
2023-12-23 23:05 ` [PATCH v2] libstdc++: " Ken Matsui
1 sibling, 0 replies; 6+ messages in thread
From: Patrick Palka @ 2023-09-11 15:50 UTC (permalink / raw)
To: Ken Matsui; +Cc: gcc-patches, libstdc++
On Mon, 11 Sep 2023, Ken Matsui via Gcc-patches wrote:
> This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin in
> the type_traits header for traits that have a corresponding fallback
> non-built-in implementation. This macro supports to toggle the use of built-in
> traits in the type_traits header through _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS
> macro, without needing to modify the source code.
>
> libstdc++-v3/ChangeLog:
>
> * include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
LGTM
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
> libstdc++-v3/include/std/type_traits | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index 677cd934b94..221c809dd6d 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -1430,7 +1430,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> : public __bool_constant<__is_base_of(_Base, _Derived)>
> { };
>
> -#if __has_builtin(__is_convertible)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
> template<typename _From, typename _To>
> struct is_convertible
> : public __bool_constant<__is_convertible(_From, _To)>
> @@ -1480,7 +1480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> #ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
>
> -#if __has_builtin(__is_nothrow_convertible)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
> /// is_nothrow_convertible_v
> template<typename _From, typename _To>
> inline constexpr bool is_nothrow_convertible_v
> @@ -1555,7 +1555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> { using type = _Tp; };
>
> /// remove_cv
> -#if __has_builtin(__remove_cv)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
> template<typename _Tp>
> struct remove_cv
> { using type = __remove_cv(_Tp); };
> @@ -1621,7 +1621,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> // Reference transformations.
>
> /// remove_reference
> -#if __has_builtin(__remove_reference)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
> template<typename _Tp>
> struct remove_reference
> { using type = __remove_reference(_Tp); };
> @@ -3427,7 +3427,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
> * @{
> */
> #ifdef __cpp_lib_remove_cvref // C++ >= 20
> -# if __has_builtin(__remove_cvref)
> +# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
> template<typename _Tp>
> struct remove_cvref
> { using type = __remove_cvref(_Tp); };
> --
> 2.42.0
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT
2023-09-11 15:27 [PATCH] libstdc++ Use _GLIBCXX_USE_BUILTIN_TRAIT Ken Matsui
2023-09-11 15:50 ` Patrick Palka
@ 2023-12-23 23:05 ` Ken Matsui
2024-01-04 21:50 ` Patrick Palka
2024-01-04 22:11 ` Jonathan Wakely
1 sibling, 2 replies; 6+ messages in thread
From: Ken Matsui @ 2023-12-23 23:05 UTC (permalink / raw)
To: gcc-patches; +Cc: libstdc++, Ken Matsui, Patrick Palka
This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin
in the type_traits header for traits that have a corresponding fallback
non-built-in implementation. This macro supports to toggle the use of
built-in traits in the type_traits header through
_GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS macro, without needing to modify the
source code.
libstdc++-v3/ChangeLog:
* include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
---
libstdc++-v3/include/std/type_traits | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index f00c07f94f9..ba35ffb27fa 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1481,7 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __bool_constant<__is_base_of(_Base, _Derived)>
{ };
-#if __has_builtin(__is_convertible)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
template<typename _From, typename _To>
struct is_convertible
: public __bool_constant<__is_convertible(_From, _To)>
@@ -1531,7 +1531,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
-#if __has_builtin(__is_nothrow_convertible)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
/// is_nothrow_convertible_v
template<typename _From, typename _To>
inline constexpr bool is_nothrow_convertible_v
@@ -1606,7 +1606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ using type = _Tp; };
/// remove_cv
-#if __has_builtin(__remove_cv)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
template<typename _Tp>
struct remove_cv
{ using type = __remove_cv(_Tp); };
@@ -1672,7 +1672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Reference transformations.
/// remove_reference
-#if __has_builtin(__remove_reference)
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
template<typename _Tp>
struct remove_reference
{ using type = __remove_reference(_Tp); };
@@ -3537,7 +3537,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
* @{
*/
#ifdef __cpp_lib_remove_cvref // C++ >= 20
-# if __has_builtin(__remove_cvref)
+# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
template<typename _Tp>
struct remove_cvref
{ using type = __remove_cvref(_Tp); };
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT
2023-12-23 23:05 ` [PATCH v2] libstdc++: " Ken Matsui
@ 2024-01-04 21:50 ` Patrick Palka
2024-01-04 22:11 ` Jonathan Wakely
1 sibling, 0 replies; 6+ messages in thread
From: Patrick Palka @ 2024-01-04 21:50 UTC (permalink / raw)
To: Ken Matsui; +Cc: gcc-patches, libstdc++, Patrick Palka
On Sat, 23 Dec 2023, Ken Matsui wrote:
> This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin
> in the type_traits header for traits that have a corresponding fallback
> non-built-in implementation. This macro supports to toggle the use of
> built-in traits in the type_traits header through
> _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS macro, without needing to modify the
> source code.
LGTM, thanks!
>
> libstdc++-v3/ChangeLog:
>
> * include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> Reviewed-by: Patrick Palka <ppalka@redhat.com>
> ---
> libstdc++-v3/include/std/type_traits | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index f00c07f94f9..ba35ffb27fa 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -1481,7 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> : public __bool_constant<__is_base_of(_Base, _Derived)>
> { };
>
> -#if __has_builtin(__is_convertible)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
> template<typename _From, typename _To>
> struct is_convertible
> : public __bool_constant<__is_convertible(_From, _To)>
> @@ -1531,7 +1531,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> #ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
>
> -#if __has_builtin(__is_nothrow_convertible)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
> /// is_nothrow_convertible_v
> template<typename _From, typename _To>
> inline constexpr bool is_nothrow_convertible_v
> @@ -1606,7 +1606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> { using type = _Tp; };
>
> /// remove_cv
> -#if __has_builtin(__remove_cv)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
> template<typename _Tp>
> struct remove_cv
> { using type = __remove_cv(_Tp); };
> @@ -1672,7 +1672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> // Reference transformations.
>
> /// remove_reference
> -#if __has_builtin(__remove_reference)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
> template<typename _Tp>
> struct remove_reference
> { using type = __remove_reference(_Tp); };
> @@ -3537,7 +3537,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
> * @{
> */
> #ifdef __cpp_lib_remove_cvref // C++ >= 20
> -# if __has_builtin(__remove_cvref)
> +# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
> template<typename _Tp>
> struct remove_cvref
> { using type = __remove_cvref(_Tp); };
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT
2023-12-23 23:05 ` [PATCH v2] libstdc++: " Ken Matsui
2024-01-04 21:50 ` Patrick Palka
@ 2024-01-04 22:11 ` Jonathan Wakely
2024-01-05 0:15 ` Ken Matsui
1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2024-01-04 22:11 UTC (permalink / raw)
To: Ken Matsui; +Cc: gcc-patches, libstdc++, Patrick Palka
On Sat, 23 Dec 2023 at 23:06, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin
> in the type_traits header for traits that have a corresponding fallback
> non-built-in implementation. This macro supports to toggle the use of
> built-in traits in the type_traits header through
> _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS macro, without needing to modify the
> source code.
OK for trunk, thanks.
+Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
> * include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> Reviewed-by: Patrick Palka <ppalka@redhat.com>
> ---
> libstdc++-v3/include/std/type_traits | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index f00c07f94f9..ba35ffb27fa 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -1481,7 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> : public __bool_constant<__is_base_of(_Base, _Derived)>
> { };
>
> -#if __has_builtin(__is_convertible)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
> template<typename _From, typename _To>
> struct is_convertible
> : public __bool_constant<__is_convertible(_From, _To)>
> @@ -1531,7 +1531,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> #ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
>
> -#if __has_builtin(__is_nothrow_convertible)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
> /// is_nothrow_convertible_v
> template<typename _From, typename _To>
> inline constexpr bool is_nothrow_convertible_v
> @@ -1606,7 +1606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> { using type = _Tp; };
>
> /// remove_cv
> -#if __has_builtin(__remove_cv)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
> template<typename _Tp>
> struct remove_cv
> { using type = __remove_cv(_Tp); };
> @@ -1672,7 +1672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> // Reference transformations.
>
> /// remove_reference
> -#if __has_builtin(__remove_reference)
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
> template<typename _Tp>
> struct remove_reference
> { using type = __remove_reference(_Tp); };
> @@ -3537,7 +3537,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
> * @{
> */
> #ifdef __cpp_lib_remove_cvref // C++ >= 20
> -# if __has_builtin(__remove_cvref)
> +# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
> template<typename _Tp>
> struct remove_cvref
> { using type = __remove_cvref(_Tp); };
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT
2024-01-04 22:11 ` Jonathan Wakely
@ 2024-01-05 0:15 ` Ken Matsui
0 siblings, 0 replies; 6+ messages in thread
From: Ken Matsui @ 2024-01-05 0:15 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: Ken Matsui, gcc-patches, libstdc++, Patrick Palka
On Thu, Jan 4, 2024 at 2:11 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Sat, 23 Dec 2023 at 23:06, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
> >
> > This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin
> > in the type_traits header for traits that have a corresponding fallback
> > non-built-in implementation. This macro supports to toggle the use of
> > built-in traits in the type_traits header through
> > _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS macro, without needing to modify the
> > source code.
>
> OK for trunk, thanks.
>
> +Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
>
Thank you for your reviews!
>
>
> >
> > libstdc++-v3/ChangeLog:
> >
> > * include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
> >
> > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> > Reviewed-by: Patrick Palka <ppalka@redhat.com>
> > ---
> > libstdc++-v3/include/std/type_traits | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> > index f00c07f94f9..ba35ffb27fa 100644
> > --- a/libstdc++-v3/include/std/type_traits
> > +++ b/libstdc++-v3/include/std/type_traits
> > @@ -1481,7 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> > : public __bool_constant<__is_base_of(_Base, _Derived)>
> > { };
> >
> > -#if __has_builtin(__is_convertible)
> > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
> > template<typename _From, typename _To>
> > struct is_convertible
> > : public __bool_constant<__is_convertible(_From, _To)>
> > @@ -1531,7 +1531,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >
> > #ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
> >
> > -#if __has_builtin(__is_nothrow_convertible)
> > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
> > /// is_nothrow_convertible_v
> > template<typename _From, typename _To>
> > inline constexpr bool is_nothrow_convertible_v
> > @@ -1606,7 +1606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> > { using type = _Tp; };
> >
> > /// remove_cv
> > -#if __has_builtin(__remove_cv)
> > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
> > template<typename _Tp>
> > struct remove_cv
> > { using type = __remove_cv(_Tp); };
> > @@ -1672,7 +1672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> > // Reference transformations.
> >
> > /// remove_reference
> > -#if __has_builtin(__remove_reference)
> > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
> > template<typename _Tp>
> > struct remove_reference
> > { using type = __remove_reference(_Tp); };
> > @@ -3537,7 +3537,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
> > * @{
> > */
> > #ifdef __cpp_lib_remove_cvref // C++ >= 20
> > -# if __has_builtin(__remove_cvref)
> > +# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
> > template<typename _Tp>
> > struct remove_cvref
> > { using type = __remove_cvref(_Tp); };
> > --
> > 2.43.0
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-05 0:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 15:27 [PATCH] libstdc++ Use _GLIBCXX_USE_BUILTIN_TRAIT Ken Matsui
2023-09-11 15:50 ` Patrick Palka
2023-12-23 23:05 ` [PATCH v2] libstdc++: " Ken Matsui
2024-01-04 21:50 ` Patrick Palka
2024-01-04 22:11 ` Jonathan Wakely
2024-01-05 0:15 ` Ken Matsui
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).