Re: [PATCH] testsuite: Remove testsuite_tr1.h

2023-12-21 Thread Patrick Palka
On Wed, 20 Dec 2023, Ken Matsui wrote:

> This patch removes the testsuite_tr1.h dependency from g++.dg/ext/is_*.C
> tests since the header is supposed to be used only by libstdc++, not
> front-end.  This also includes test code consistency fixes.

LGTM

> 
> gcc/testsuite/ChangeLog:
> 
>   * g++.dg/ext/is_array.C: Remove testsuite_tr1.h.  Add necessary
>   definitions accordingly.  Tweak macros for consistency across
>   test codes.
>   * g++.dg/ext/is_bounded_array.C: Likewise.
>   * g++.dg/ext/is_function.C: Likewise.
>   * g++.dg/ext/is_member_function_pointer.C: Likewise.
>   * g++.dg/ext/is_member_object_pointer.C: Likewise.
>   * g++.dg/ext/is_member_pointer.C: Likewise.
>   * g++.dg/ext/is_object.C: Likewise.
>   * g++.dg/ext/is_reference.C: Likewise.
>   * g++.dg/ext/is_scoped_enum.C: Likewise.
> 
> Signed-off-by: Ken Matsui 
> ---
>  gcc/testsuite/g++.dg/ext/is_array.C   | 15 ---
>  gcc/testsuite/g++.dg/ext/is_bounded_array.C   | 20 -
>  gcc/testsuite/g++.dg/ext/is_function.C| 41 +++
>  .../g++.dg/ext/is_member_function_pointer.C   | 14 +++
>  .../g++.dg/ext/is_member_object_pointer.C | 26 ++--
>  gcc/testsuite/g++.dg/ext/is_member_pointer.C  | 29 ++---
>  gcc/testsuite/g++.dg/ext/is_object.C  | 21 --
>  gcc/testsuite/g++.dg/ext/is_reference.C   | 28 +++--
>  gcc/testsuite/g++.dg/ext/is_scoped_enum.C | 12 ++
>  9 files changed, 101 insertions(+), 105 deletions(-)
> 
> diff --git a/gcc/testsuite/g++.dg/ext/is_array.C 
> b/gcc/testsuite/g++.dg/ext/is_array.C
> index facfed5c7cb..f1a6e08b87a 100644
> --- a/gcc/testsuite/g++.dg/ext/is_array.C
> +++ b/gcc/testsuite/g++.dg/ext/is_array.C
> @@ -1,15 +1,14 @@
>  // { dg-do compile { target c++11 } }
>  
> -#include 
> +#define SA(X) static_assert((X),#X)
>  
> -using namespace __gnu_test;
> +#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)\
> +  SA(TRAIT(TYPE) == EXPECT); \
> +  SA(TRAIT(const TYPE) == EXPECT);   \
> +  SA(TRAIT(volatile TYPE) == EXPECT);\
> +  SA(TRAIT(const volatile TYPE) == EXPECT)
>  
> -#define SA(X) static_assert((X),#X)
> -#define SA_TEST_CATEGORY(TRAIT, X, expect) \
> -  SA(TRAIT(X) == expect);  \
> -  SA(TRAIT(const X) == expect);\
> -  SA(TRAIT(volatile X) == expect); \
> -  SA(TRAIT(const volatile X) == expect)
> +class ClassType { };
>  
>  SA_TEST_CATEGORY(__is_array, int[2], true);
>  SA_TEST_CATEGORY(__is_array, int[], true);
> diff --git a/gcc/testsuite/g++.dg/ext/is_bounded_array.C 
> b/gcc/testsuite/g++.dg/ext/is_bounded_array.C
> index 346790eba12..b5fe435de95 100644
> --- a/gcc/testsuite/g++.dg/ext/is_bounded_array.C
> +++ b/gcc/testsuite/g++.dg/ext/is_bounded_array.C
> @@ -1,21 +1,19 @@
>  // { dg-do compile { target c++11 } }
>  
> -#include 
> -
> -using namespace __gnu_test;
> -
>  #define SA(X) static_assert((X),#X)
>  
> -#define SA_TEST_CONST(TRAIT, TYPE, EXPECT)   \
> +#define SA_TEST_FN(TRAIT, TYPE, EXPECT)  \
>SA(TRAIT(TYPE) == EXPECT); \
> -  SA(TRAIT(const TYPE) == EXPECT)
> +  SA(TRAIT(const TYPE) == EXPECT);
>  
>  #define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)\
> -  SA(TRAIT(TYPE) == EXPECT); \
> -  SA(TRAIT(const TYPE) == EXPECT);   \
> -  SA(TRAIT(volatile TYPE) == EXPECT);\
> +  SA(TRAIT(TYPE) == EXPECT); \
> +  SA(TRAIT(const TYPE) == EXPECT);   \
> +  SA(TRAIT(volatile TYPE) == EXPECT);\
>SA(TRAIT(const volatile TYPE) == EXPECT)
>  
> +class ClassType { };
> +
>  SA_TEST_CATEGORY(__is_bounded_array, int[2], true);
>  SA_TEST_CATEGORY(__is_bounded_array, int[], false);
>  SA_TEST_CATEGORY(__is_bounded_array, int[2][3], true);
> @@ -31,8 +29,8 @@ SA_TEST_CATEGORY(__is_bounded_array, ClassType[][3], false);
>  SA_TEST_CATEGORY(__is_bounded_array, int(*)[2], false);
>  SA_TEST_CATEGORY(__is_bounded_array, int(*)[], false);
>  SA_TEST_CATEGORY(__is_bounded_array, int(&)[2], false);
> -SA_TEST_CONST(__is_bounded_array, int(&)[], false);
> +SA_TEST_FN(__is_bounded_array, int(&)[], false);
>  
>  // Sanity check.
>  SA_TEST_CATEGORY(__is_bounded_array, ClassType, false);
> -SA_TEST_CONST(__is_bounded_array, void(), false);
> +SA_TEST_FN(__is_bounded_array, void(), false);
> diff --git a/gcc/testsuite/g++.dg/ext/is_function.C 
> b/gcc/testsuite/g++.dg/ext/is_function.C
> index 2e1594b12ad..1fc3c96df1f 100644
> --- a/gcc/testsuite/g++.dg/ext/is_function.C
> +++ b/gcc/testsuite/g++.dg/ext/is_function.C
> @@ -1,16 +1,19 @@
>  // { dg-do compile { target c++11 } }
>  
> -#include 
> +#define SA(X) static_assert((X),#X)
>  
> -using namespace __gnu_test;
> +#define SA_TEST_FN(TRAIT, TYPE, EXPECT)  \
> +  SA(TRAIT(TYPE) == EXPECT); \
> +  SA(TRAIT(const TYPE) == EXPECT);
>  
> -#define SA(X) static_as

Re: [PATCH] testsuite: Remove testsuite_tr1.h

2023-12-21 Thread Patrick Palka
On Thu, Dec 21, 2023 at 8:29 AM Patrick Palka  wrote:
>
> On Wed, 20 Dec 2023, Ken Matsui wrote:
>
> > This patch removes the testsuite_tr1.h dependency from g++.dg/ext/is_*.C
> > tests since the header is supposed to be used only by libstdc++, not
> > front-end.  This also includes test code consistency fixes.

For the record this fixes the test failures reported at
https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641058.html

>
> LGTM

Very minor but let's use the commit title

  c++: testsuite: Remove testsuite_tr1.h includes

to convey that the commit only touches C++ tests, and isn't removing
the file testsuite_tr1.h but rather #includes of it :)

>
> >
> > gcc/testsuite/ChangeLog:
> >
> >   * g++.dg/ext/is_array.C: Remove testsuite_tr1.h.  Add necessary
> >   definitions accordingly.  Tweak macros for consistency across
> >   test codes.
> >   * g++.dg/ext/is_bounded_array.C: Likewise.
> >   * g++.dg/ext/is_function.C: Likewise.
> >   * g++.dg/ext/is_member_function_pointer.C: Likewise.
> >   * g++.dg/ext/is_member_object_pointer.C: Likewise.
> >   * g++.dg/ext/is_member_pointer.C: Likewise.
> >   * g++.dg/ext/is_object.C: Likewise.
> >   * g++.dg/ext/is_reference.C: Likewise.
> >   * g++.dg/ext/is_scoped_enum.C: Likewise.
> >
> > Signed-off-by: Ken Matsui 
> > ---
> >  gcc/testsuite/g++.dg/ext/is_array.C   | 15 ---
> >  gcc/testsuite/g++.dg/ext/is_bounded_array.C   | 20 -
> >  gcc/testsuite/g++.dg/ext/is_function.C| 41 +++
> >  .../g++.dg/ext/is_member_function_pointer.C   | 14 +++
> >  .../g++.dg/ext/is_member_object_pointer.C | 26 ++--
> >  gcc/testsuite/g++.dg/ext/is_member_pointer.C  | 29 ++---
> >  gcc/testsuite/g++.dg/ext/is_object.C  | 21 --
> >  gcc/testsuite/g++.dg/ext/is_reference.C   | 28 +++--
> >  gcc/testsuite/g++.dg/ext/is_scoped_enum.C | 12 ++
> >  9 files changed, 101 insertions(+), 105 deletions(-)
> >
> > diff --git a/gcc/testsuite/g++.dg/ext/is_array.C 
> > b/gcc/testsuite/g++.dg/ext/is_array.C
> > index facfed5c7cb..f1a6e08b87a 100644
> > --- a/gcc/testsuite/g++.dg/ext/is_array.C
> > +++ b/gcc/testsuite/g++.dg/ext/is_array.C
> > @@ -1,15 +1,14 @@
> >  // { dg-do compile { target c++11 } }
> >
> > -#include 
> > +#define SA(X) static_assert((X),#X)
> >
> > -using namespace __gnu_test;
> > +#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)\
> > +  SA(TRAIT(TYPE) == EXPECT); \
> > +  SA(TRAIT(const TYPE) == EXPECT);   \
> > +  SA(TRAIT(volatile TYPE) == EXPECT);\
> > +  SA(TRAIT(const volatile TYPE) == EXPECT)
> >
> > -#define SA(X) static_assert((X),#X)
> > -#define SA_TEST_CATEGORY(TRAIT, X, expect) \
> > -  SA(TRAIT(X) == expect);  \
> > -  SA(TRAIT(const X) == expect);\
> > -  SA(TRAIT(volatile X) == expect); \
> > -  SA(TRAIT(const volatile X) == expect)
> > +class ClassType { };
> >
> >  SA_TEST_CATEGORY(__is_array, int[2], true);
> >  SA_TEST_CATEGORY(__is_array, int[], true);
> > diff --git a/gcc/testsuite/g++.dg/ext/is_bounded_array.C 
> > b/gcc/testsuite/g++.dg/ext/is_bounded_array.C
> > index 346790eba12..b5fe435de95 100644
> > --- a/gcc/testsuite/g++.dg/ext/is_bounded_array.C
> > +++ b/gcc/testsuite/g++.dg/ext/is_bounded_array.C
> > @@ -1,21 +1,19 @@
> >  // { dg-do compile { target c++11 } }
> >
> > -#include 
> > -
> > -using namespace __gnu_test;
> > -
> >  #define SA(X) static_assert((X),#X)
> >
> > -#define SA_TEST_CONST(TRAIT, TYPE, EXPECT)   \
> > +#define SA_TEST_FN(TRAIT, TYPE, EXPECT)  \
> >SA(TRAIT(TYPE) == EXPECT); \
> > -  SA(TRAIT(const TYPE) == EXPECT)
> > +  SA(TRAIT(const TYPE) == EXPECT);
> >
> >  #define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)\
> > -  SA(TRAIT(TYPE) == EXPECT); \
> > -  SA(TRAIT(const TYPE) == EXPECT);   \
> > -  SA(TRAIT(volatile TYPE) == EXPECT);\
> > +  SA(TRAIT(TYPE) == EXPECT); \
> > +  SA(TRAIT(const TYPE) == EXPECT);   \
> > +  SA(TRAIT(volatile TYPE) == EXPECT);\
> >SA(TRAIT(const volatile TYPE) == EXPECT)
> >
> > +class ClassType { };
> > +
> >  SA_TEST_CATEGORY(__is_bounded_array, int[2], true);
> >  SA_TEST_CATEGORY(__is_bounded_array, int[], false);
> >  SA_TEST_CATEGORY(__is_bounded_array, int[2][3], true);
> > @@ -31,8 +29,8 @@ SA_TEST_CATEGORY(__is_bounded_array, ClassType[][3], 
> > false);
> >  SA_TEST_CATEGORY(__is_bounded_array, int(*)[2], false);
> >  SA_TEST_CATEGORY(__is_bounded_array, int(*)[], false);
> >  SA_TEST_CATEGORY(__is_bounded_array, int(&)[2], false);
> > -SA_TEST_CONST(__is_bounded_array, int(&)[], false);
> > +SA_TEST_FN(__is_bounded_array, int(&)[], false);
> >
> >  // Sanity check.
> >  SA_TEST_CATEGORY(__is_bounded_array, ClassType, false);
> > -SA_TEST_CONST(__is_bounded_array, void(), false);
> > +SA_TEST

Re: [PATCH] testsuite: Remove testsuite_tr1.h

2023-12-21 Thread Jason Merrill

On 12/21/23 10:52, Patrick Palka wrote:

On Thu, Dec 21, 2023 at 8:29 AM Patrick Palka  wrote:


On Wed, 20 Dec 2023, Ken Matsui wrote:


This patch removes the testsuite_tr1.h dependency from g++.dg/ext/is_*.C
tests since the header is supposed to be used only by libstdc++, not
front-end.  This also includes test code consistency fixes.


For the record this fixes the test failures reported at
https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641058.html



LGTM


Very minor but let's use the commit title

   c++: testsuite: Remove testsuite_tr1.h includes

to convey that the commit only touches C++ tests, and isn't removing
the file testsuite_tr1.h but rather #includes of it :)


OK with that change.

Jason



Re: [PATCH] testsuite: Remove testsuite_tr1.h

2023-12-22 Thread Ken Matsui
On Thu, Dec 21, 2023 at 11:38 AM Jason Merrill  wrote:
>
> On 12/21/23 10:52, Patrick Palka wrote:
> > On Thu, Dec 21, 2023 at 8:29 AM Patrick Palka  wrote:
> >>
> >> On Wed, 20 Dec 2023, Ken Matsui wrote:
> >>
> >>> This patch removes the testsuite_tr1.h dependency from g++.dg/ext/is_*.C
> >>> tests since the header is supposed to be used only by libstdc++, not
> >>> front-end.  This also includes test code consistency fixes.
> >
> > For the record this fixes the test failures reported at
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641058.html
> >
> >>
> >> LGTM
> >
> > Very minor but let's use the commit title
> >
> >c++: testsuite: Remove testsuite_tr1.h includes
> >
> > to convey that the commit only touches C++ tests, and isn't removing
> > the file testsuite_tr1.h but rather #includes of it :)
>
> OK with that change.
>

Thank you for your all's reviews!  I will soon push.

> Jason
>