diff options
author | Ken Matsui <kmatsui@gcc.gnu.org> | 2023-12-20 10:47:27 -0800 |
---|---|---|
committer | Ken Matsui <kmatsui@gcc.gnu.org> | 2023-12-22 01:57:30 -0800 |
commit | c4d1d1adf75bcf4a91a936c0a33cfc5242cc4e1f (patch) | |
tree | 6b767aca1caa9b75e2bd62bbf156e5f75110434b /gcc | |
parent | 5bd5ef99579cd11f00f02a30634ef8b4d11018fb (diff) | |
download | gcc-c4d1d1adf75bcf4a91a936c0a33cfc5242cc4e1f.zip gcc-c4d1d1adf75bcf4a91a936c0a33cfc5242cc4e1f.tar.gz gcc-c4d1d1adf75bcf4a91a936c0a33cfc5242cc4e1f.tar.bz2 |
c++: testsuite: Remove testsuite_tr1.h includes
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
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 <kmatsui@gcc.gnu.org>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_array.C | 15 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_bounded_array.C | 20 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_function.C | 41 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_member_function_pointer.C | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_member_object_pointer.C | 26 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_member_pointer.C | 29 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_object.C | 21 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_reference.C | 28 | ||||
-rw-r--r-- | 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 facfed5..f1a6e08 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 <testsuite_tr1.h> +#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 346790e..b5fe435 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 <testsuite_tr1.h> - -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 2e1594b..1fc3c96 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 <testsuite_tr1.h> +#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_assert((X),#X) #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 { }; + struct A { void fn(); }; @@ -22,15 +25,15 @@ struct AHolder<U T::*> { using type = U; }; // Positive tests. -SA(__is_function(int (int))); -SA(__is_function(ClassType (ClassType))); -SA(__is_function(float (int, float, int[], int&))); -SA(__is_function(int (int, ...))); -SA(__is_function(bool (ClassType) const)); -SA(__is_function(AHolder<decltype(&A::fn)>::type)); +SA_TEST_FN(__is_function, int (int), true); +SA_TEST_FN(__is_function, ClassType (ClassType), true); +SA_TEST_FN(__is_function, float (int, float, int[], int&), true); +SA_TEST_FN(__is_function, int (int, ...), true); +SA_TEST_FN(__is_function, bool (ClassType) const, true); +SA_TEST_FN(__is_function, AHolder<decltype(&A::fn)>::type, true); void fn(); -SA(__is_function(decltype(fn))); +SA_TEST_FN(__is_function, decltype(fn), true); // Negative tests. SA_TEST_CATEGORY(__is_function, int, false); @@ -39,11 +42,15 @@ SA_TEST_CATEGORY(__is_function, int&, false); SA_TEST_CATEGORY(__is_function, void, false); SA_TEST_CATEGORY(__is_function, void*, false); SA_TEST_CATEGORY(__is_function, void**, false); -SA_TEST_CATEGORY(__is_function, std::nullptr_t, false); +SA_TEST_CATEGORY(__is_function, decltype(nullptr), false); +class AbstractClass +{ + virtual void rotate(int) = 0; +}; SA_TEST_CATEGORY(__is_function, AbstractClass, false); -SA(!__is_function(int(&)(int))); -SA(!__is_function(int(*)(int))); +SA_TEST_FN(__is_function, int(&)(int), false); +SA_TEST_FN(__is_function, int(*)(int), false); SA_TEST_CATEGORY(__is_function, A, false); SA_TEST_CATEGORY(__is_function, decltype(&A::fn), false); @@ -53,6 +60,8 @@ struct FnCallOverload SA_TEST_CATEGORY(__is_function, FnCallOverload, false); // Sanity check. +class IncompleteClass; +union IncompleteUnion; SA_TEST_CATEGORY(__is_function, ClassType, false); SA_TEST_CATEGORY(__is_function, IncompleteClass, false); SA_TEST_CATEGORY(__is_function, IncompleteUnion, false); diff --git a/gcc/testsuite/g++.dg/ext/is_member_function_pointer.C b/gcc/testsuite/g++.dg/ext/is_member_function_pointer.C index 555123e..4435a65 100644 --- a/gcc/testsuite/g++.dg/ext/is_member_function_pointer.C +++ b/gcc/testsuite/g++.dg/ext/is_member_function_pointer.C @@ -1,21 +1,19 @@ // { dg-do compile { target c++11 } } -#include <testsuite_tr1.h> - -using namespace __gnu_test; - #define SA(X) static_assert((X),#X) -#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ +#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ SA(TRAIT(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 { }; + // Positive tests. SA_TEST_FN(__is_member_function_pointer, int (ClassType::*) (int), true); SA_TEST_FN(__is_member_function_pointer, int (ClassType::*) (int) const, true); diff --git a/gcc/testsuite/g++.dg/ext/is_member_object_pointer.C b/gcc/testsuite/g++.dg/ext/is_member_object_pointer.C index 835e48c..2d01feb 100644 --- a/gcc/testsuite/g++.dg/ext/is_member_object_pointer.C +++ b/gcc/testsuite/g++.dg/ext/is_member_object_pointer.C @@ -1,30 +1,28 @@ // { dg-do compile { target c++11 } } -#include <testsuite_tr1.h> - -using namespace __gnu_test; - #define SA(X) static_assert((X),#X) -#define SA_TEST_NON_VOLATILE(TRAIT, TYPE, EXPECT) \ - SA(TRAIT(TYPE) == EXPECT); \ - SA(TRAIT(const TYPE) == EXPECT) +#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ + SA(TRAIT(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 { }; + // Positive tests. SA_TEST_CATEGORY(__is_member_object_pointer, int (ClassType::*), true); SA_TEST_CATEGORY(__is_member_object_pointer, ClassType (ClassType::*), true); // Negative tests. -SA_TEST_NON_VOLATILE(__is_member_object_pointer, int (ClassType::*) (int), false); -SA_TEST_NON_VOLATILE(__is_member_object_pointer, int (ClassType::*) (float, ...), false); -SA_TEST_NON_VOLATILE(__is_member_object_pointer, ClassType (ClassType::*) (ClassType), false); -SA_TEST_NON_VOLATILE(__is_member_object_pointer, float (ClassType::*) (int, float, int[], int&), false); +SA_TEST_FN(__is_member_object_pointer, int (ClassType::*) (int), false); +SA_TEST_FN(__is_member_object_pointer, int (ClassType::*) (float, ...), false); +SA_TEST_FN(__is_member_object_pointer, ClassType (ClassType::*) (ClassType), false); +SA_TEST_FN(__is_member_object_pointer, float (ClassType::*) (int, float, int[], int&), false); // Sanity check. SA_TEST_CATEGORY(__is_member_object_pointer, ClassType, false); diff --git a/gcc/testsuite/g++.dg/ext/is_member_pointer.C b/gcc/testsuite/g++.dg/ext/is_member_pointer.C index 7ee2e3a..c6ecbe3 100644 --- a/gcc/testsuite/g++.dg/ext/is_member_pointer.C +++ b/gcc/testsuite/g++.dg/ext/is_member_pointer.C @@ -1,30 +1,27 @@ // { dg-do compile { target c++11 } } -#include <testsuite_tr1.h> - -using namespace __gnu_test; - #define SA(X) static_assert((X),#X) -#define SA_TEST_NON_VOLATILE(TRAIT, TYPE, EXPECT) \ - SA(TRAIT(TYPE) == EXPECT); \ - SA(TRAIT(const TYPE) == EXPECT) +#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ + SA(TRAIT(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_member_pointer, int (ClassType::*), true); SA_TEST_CATEGORY(__is_member_pointer, ClassType (ClassType::*), true); -SA_TEST_NON_VOLATILE(__is_member_pointer, int (ClassType::*)(int), true); -SA_TEST_NON_VOLATILE(__is_member_pointer, int (ClassType::*)(int) const, true); -SA_TEST_NON_VOLATILE(__is_member_pointer, int (ClassType::*)(float, ...), true); -SA_TEST_NON_VOLATILE(__is_member_pointer, ClassType (ClassType::*)(ClassType), true); -SA_TEST_NON_VOLATILE(__is_member_pointer, - float (ClassType::*)(int, float, int[], int&), true); +SA_TEST_FN(__is_member_pointer, int (ClassType::*)(int), true); +SA_TEST_FN(__is_member_pointer, int (ClassType::*)(int) const, true); +SA_TEST_FN(__is_member_pointer, int (ClassType::*)(float, ...), true); +SA_TEST_FN(__is_member_pointer, ClassType (ClassType::*)(ClassType), true); +SA_TEST_FN(__is_member_pointer, float (ClassType::*)(int, float, int[], int&), true); // Sanity check. SA_TEST_CATEGORY(__is_member_pointer, ClassType, false); diff --git a/gcc/testsuite/g++.dg/ext/is_object.C b/gcc/testsuite/g++.dg/ext/is_object.C index 5c759a5..7e66b6a 100644 --- a/gcc/testsuite/g++.dg/ext/is_object.C +++ b/gcc/testsuite/g++.dg/ext/is_object.C @@ -1,14 +1,10 @@ // { dg-do compile { target c++11 } } -#include <testsuite_tr1.h> - -using namespace __gnu_test; - #define SA(X) static_assert((X),#X) -#define SA_TEST_NON_VOLATILE(TRAIT, TYPE, EXPECT) \ - SA(TRAIT(TYPE) == EXPECT); \ - SA(TRAIT(const TYPE) == EXPECT) +#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ + SA(TRAIT(TYPE) == EXPECT); \ + SA(TRAIT(const TYPE) == EXPECT); #define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT) \ SA(TRAIT(TYPE) == EXPECT); \ @@ -16,13 +12,14 @@ using namespace __gnu_test; SA(TRAIT(volatile TYPE) == EXPECT); \ SA(TRAIT(const volatile TYPE) == EXPECT) -SA_TEST_NON_VOLATILE(__is_object, int (int), false); -SA_TEST_NON_VOLATILE(__is_object, ClassType (ClassType), false); -SA_TEST_NON_VOLATILE(__is_object, - float (int, float, int[], int&), false); +class ClassType { }; + +SA_TEST_FN(__is_object, int (int), false); +SA_TEST_FN(__is_object, ClassType (ClassType), false); +SA_TEST_FN(__is_object, float (int, float, int[], int&), false); SA_TEST_CATEGORY(__is_object, int&, false); SA_TEST_CATEGORY(__is_object, ClassType&, false); -SA_TEST_NON_VOLATILE(__is_object, int(&)(int), false); +SA_TEST_FN(__is_object, int(&)(int), false); SA_TEST_CATEGORY(__is_object, void, false); // Sanity check. diff --git a/gcc/testsuite/g++.dg/ext/is_reference.C b/gcc/testsuite/g++.dg/ext/is_reference.C index b5ce4db..88dd3bf 100644 --- a/gcc/testsuite/g++.dg/ext/is_reference.C +++ b/gcc/testsuite/g++.dg/ext/is_reference.C @@ -1,33 +1,37 @@ // { dg-do compile { target c++11 } } -#include <testsuite_tr1.h> +#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_assert((X),#X) #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 { }; +class IncompleteClass; + // Positive tests. SA_TEST_CATEGORY(__is_reference, int&, true); SA_TEST_CATEGORY(__is_reference, ClassType&, true); -SA(__is_reference(int(&)(int))); +SA_TEST_FN(__is_reference, int(&)(int), true); SA_TEST_CATEGORY(__is_reference, int&&, true); SA_TEST_CATEGORY(__is_reference, ClassType&&, true); -SA(__is_reference(int(&&)(int))); +SA_TEST_FN(__is_reference, int(&&)(int), true); SA_TEST_CATEGORY(__is_reference, IncompleteClass&, true); // Negative tests SA_TEST_CATEGORY(__is_reference, void, false); SA_TEST_CATEGORY(__is_reference, int*, false); SA_TEST_CATEGORY(__is_reference, int[3], false); -SA(!__is_reference(int(int))); -SA(!__is_reference(int(*const)(int))); -SA(!__is_reference(int(*volatile)(int))); -SA(!__is_reference(int(*const volatile)(int))); +SA_TEST_FN(__is_reference, int(int), false); +SA_TEST_FN(__is_reference, int(*const)(int), false); +SA_TEST_FN(__is_reference, int(*volatile)(int), false); +SA_TEST_FN(__is_reference, int(*const volatile)(int), false); // Sanity check. SA_TEST_CATEGORY(__is_reference, ClassType, false); diff --git a/gcc/testsuite/g++.dg/ext/is_scoped_enum.C b/gcc/testsuite/g++.dg/ext/is_scoped_enum.C index a563b6e..fdf36c6 100644 --- a/gcc/testsuite/g++.dg/ext/is_scoped_enum.C +++ b/gcc/testsuite/g++.dg/ext/is_scoped_enum.C @@ -1,19 +1,15 @@ // { dg-do compile { target c++11 } } -#include <testsuite_tr1.h> - -using namespace __gnu_test; - #define SA(X) static_assert((X),#X) -#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ +#define SA_TEST_FN(TRAIT, TYPE, EXPECT) \ SA(TRAIT(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) enum class E { e1, e2 }; |