diff mbox series

[4/4] libstdc++: Remove std::__is_pointer and std::__is_scalar [PR115497]

Message ID 20240620153240.2022128-4-jwakely@redhat.com
State New
Headers show
Series [1/4] libstdc++: Don't use std::__is_scalar in std::valarray initialization [PR115497] | expand

Commit Message

Jonathan Wakely June 20, 2024, 3:30 p.m. UTC
We still have __is_arithmetic in <bits/cpp_type_traits.h> after this,
but that needs a lot more work to remove its uses from <cmath> and
<tr1/cmath>.

Tested x86_64-linux.

-- >8 --

This removes the std::__is_pointer and std::__is_scalar traits, as they
conflicts with a Clang built-in.

Although Clang has a hack to make the class templates work despite using
reserved names, removing these class templates will allow that hack to
be dropped at some future date.

libstdc++-v3/ChangeLog:

	PR libstdc++/115497
	* include/bits/cpp_type_traits.h (__is_pointer, __is_scalar):
	Remove.
	(__is_arithmetic): Do not use __is_pointer in the primary
	template. Add partial specialization for pointers.
---
 libstdc++-v3/include/bits/cpp_type_traits.h | 33 ---------------------
 1 file changed, 33 deletions(-)

Comments

Jonathan Wakely June 21, 2024, 9:31 a.m. UTC | #1
Oops, this patch series actually depends on
https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655267.html which
was posted separately, but needs to be applied before 4/4 in this
series.

On Thu, 20 Jun 2024 at 16:35, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> We still have __is_arithmetic in <bits/cpp_type_traits.h> after this,
> but that needs a lot more work to remove its uses from <cmath> and
> <tr1/cmath>.
>
> Tested x86_64-linux.
>
> -- >8 --
>
> This removes the std::__is_pointer and std::__is_scalar traits, as they
> conflicts with a Clang built-in.
>
> Although Clang has a hack to make the class templates work despite using
> reserved names, removing these class templates will allow that hack to
> be dropped at some future date.
>
> libstdc++-v3/ChangeLog:
>
>         PR libstdc++/115497
>         * include/bits/cpp_type_traits.h (__is_pointer, __is_scalar):
>         Remove.
>         (__is_arithmetic): Do not use __is_pointer in the primary
>         template. Add partial specialization for pointers.
> ---
>  libstdc++-v3/include/bits/cpp_type_traits.h | 33 ---------------------
>  1 file changed, 33 deletions(-)
>
> diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
> index 4d83b9472e6..abe0c7603e3 100644
> --- a/libstdc++-v3/include/bits/cpp_type_traits.h
> +++ b/libstdc++-v3/include/bits/cpp_type_traits.h
> @@ -343,31 +343,6 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
>      };
>  #endif
>
> -  //
> -  // Pointer types
> -  //
> -#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
> -  template<typename _Tp, bool _IsPtr = __is_pointer(_Tp)>
> -    struct __is_pointer : __truth_type<_IsPtr>
> -    {
> -      enum { __value = _IsPtr };
> -    };
> -#else
> -  template<typename _Tp>
> -    struct __is_pointer
> -    {
> -      enum { __value = 0 };
> -      typedef __false_type __type;
> -    };
> -
> -  template<typename _Tp>
> -    struct __is_pointer<_Tp*>
> -    {
> -      enum { __value = 1 };
> -      typedef __true_type __type;
> -    };
> -#endif
> -
>    //
>    // An arithmetic type is an integer type or a floating point type
>    //
> @@ -376,14 +351,6 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
>      : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
>      { };
>
> -  //
> -  // A scalar type is an arithmetic type or a pointer type
> -  //
> -  template<typename _Tp>
> -    struct __is_scalar
> -    : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
> -    { };
> -
>    //
>    // For use in std::copy and std::find overloads for streambuf iterators.
>    //
> --
> 2.45.2
>
Jonathan Wakely June 21, 2024, 4:08 p.m. UTC | #2
This series (and the patch it depends on) have been pushed to trunk now.


On Fri, 21 Jun 2024 at 10:31, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> Oops, this patch series actually depends on
> https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655267.html which
> was posted separately, but needs to be applied before 4/4 in this
> series.
>
> On Thu, 20 Jun 2024 at 16:35, Jonathan Wakely <jwakely@redhat.com> wrote:
> >
> > We still have __is_arithmetic in <bits/cpp_type_traits.h> after this,
> > but that needs a lot more work to remove its uses from <cmath> and
> > <tr1/cmath>.
> >
> > Tested x86_64-linux.
> >
> > -- >8 --
> >
> > This removes the std::__is_pointer and std::__is_scalar traits, as they
> > conflicts with a Clang built-in.
> >
> > Although Clang has a hack to make the class templates work despite using
> > reserved names, removing these class templates will allow that hack to
> > be dropped at some future date.
> >
> > libstdc++-v3/ChangeLog:
> >
> >         PR libstdc++/115497
> >         * include/bits/cpp_type_traits.h (__is_pointer, __is_scalar):
> >         Remove.
> >         (__is_arithmetic): Do not use __is_pointer in the primary
> >         template. Add partial specialization for pointers.
> > ---
> >  libstdc++-v3/include/bits/cpp_type_traits.h | 33 ---------------------
> >  1 file changed, 33 deletions(-)
> >
> > diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
> > index 4d83b9472e6..abe0c7603e3 100644
> > --- a/libstdc++-v3/include/bits/cpp_type_traits.h
> > +++ b/libstdc++-v3/include/bits/cpp_type_traits.h
> > @@ -343,31 +343,6 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
> >      };
> >  #endif
> >
> > -  //
> > -  // Pointer types
> > -  //
> > -#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
> > -  template<typename _Tp, bool _IsPtr = __is_pointer(_Tp)>
> > -    struct __is_pointer : __truth_type<_IsPtr>
> > -    {
> > -      enum { __value = _IsPtr };
> > -    };
> > -#else
> > -  template<typename _Tp>
> > -    struct __is_pointer
> > -    {
> > -      enum { __value = 0 };
> > -      typedef __false_type __type;
> > -    };
> > -
> > -  template<typename _Tp>
> > -    struct __is_pointer<_Tp*>
> > -    {
> > -      enum { __value = 1 };
> > -      typedef __true_type __type;
> > -    };
> > -#endif
> > -
> >    //
> >    // An arithmetic type is an integer type or a floating point type
> >    //
> > @@ -376,14 +351,6 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
> >      : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
> >      { };
> >
> > -  //
> > -  // A scalar type is an arithmetic type or a pointer type
> > -  //
> > -  template<typename _Tp>
> > -    struct __is_scalar
> > -    : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
> > -    { };
> > -
> >    //
> >    // For use in std::copy and std::find overloads for streambuf iterators.
> >    //
> > --
> > 2.45.2
> >
diff mbox series

Patch

diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index 4d83b9472e6..abe0c7603e3 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -343,31 +343,6 @@  __INT_N(__GLIBCXX_TYPE_INT_N_3)
     };
 #endif
 
-  //
-  // Pointer types
-  //
-#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
-  template<typename _Tp, bool _IsPtr = __is_pointer(_Tp)>
-    struct __is_pointer : __truth_type<_IsPtr>
-    {
-      enum { __value = _IsPtr };
-    };
-#else
-  template<typename _Tp>
-    struct __is_pointer
-    {
-      enum { __value = 0 };
-      typedef __false_type __type;
-    };
-
-  template<typename _Tp>
-    struct __is_pointer<_Tp*>
-    {
-      enum { __value = 1 };
-      typedef __true_type __type;
-    };
-#endif
-
   //
   // An arithmetic type is an integer type or a floating point type
   //
@@ -376,14 +351,6 @@  __INT_N(__GLIBCXX_TYPE_INT_N_3)
     : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
     { };
 
-  //
-  // A scalar type is an arithmetic type or a pointer type
-  // 
-  template<typename _Tp>
-    struct __is_scalar
-    : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
-    { };
-
   //
   // For use in std::copy and std::find overloads for streambuf iterators.
   //