The testsuite will automatically select C++20 for these tests now, and removing the hardcoded -std option allows them to be tested for C++23 and C++26 as well.
We can also combine the { dg-require-effective-target c++2a } directive with the dg-do selector. We need to add the no_pch options for tests that define _GLIBCXX_ASSERTIONS in the test, otherwise the PCH is included without that defined. libstdc++-v3/ChangeLog: * testsuite/23_containers/span/back_assert_neg.cc: Remove dg-options and add effective target selector to dg-do. Add no_pch. * testsuite/23_containers/span/back_neg.cc: Likewise. * testsuite/23_containers/span/cons_1_assert_neg.cc: Likewise. * testsuite/23_containers/span/cons_2_assert_neg.cc: Likewise. * testsuite/23_containers/span/first_2_assert_neg.cc: Likewise. * testsuite/23_containers/span/first_assert_neg.cc: Likewise. * testsuite/23_containers/span/first_neg.cc: Likewise. * testsuite/23_containers/span/front_assert_neg.cc: Likewise. * testsuite/23_containers/span/front_neg.cc: Likewise. * testsuite/23_containers/span/index_op_assert_neg.cc: Likewise. * testsuite/23_containers/span/index_op_neg.cc: Likewise. * testsuite/23_containers/span/last_2_assert_neg.cc: Likewise. * testsuite/23_containers/span/last_assert_neg.cc: Likewise. * testsuite/23_containers/span/last_neg.cc: Likewise. * testsuite/23_containers/span/subspan_2_assert_neg.cc: Likewise. * testsuite/23_containers/span/subspan_3_assert_neg.cc: Likewise. * testsuite/23_containers/span/subspan_4_assert_neg.cc: Likewise. * testsuite/23_containers/span/subspan_5_assert_neg.cc: Likewise. * testsuite/23_containers/span/subspan_6_assert_neg.cc: Likewise. * testsuite/23_containers/span/subspan_assert_neg.cc: Likewise. * testsuite/23_containers/span/subspan_neg.cc: Likewise. * testsuite/24_iterators/range_operations/advance_debug_neg.cc: Likewise. --- libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/back_neg.cc | 3 +-- .../testsuite/23_containers/span/cons_1_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/cons_2_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/first_2_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/first_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/first_neg.cc | 3 +-- .../testsuite/23_containers/span/front_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/front_neg.cc | 3 +-- .../testsuite/23_containers/span/index_op_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc | 3 +-- .../testsuite/23_containers/span/last_2_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/last_neg.cc | 3 +-- .../testsuite/23_containers/span/subspan_2_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/subspan_3_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/subspan_4_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/subspan_5_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/subspan_6_assert_neg.cc | 5 ++--- .../testsuite/23_containers/span/subspan_assert_neg.cc | 5 ++--- libstdc++-v3/testsuite/23_containers/span/subspan_neg.cc | 3 +-- .../24_iterators/range_operations/advance_debug_neg.cc | 5 ++--- 22 files changed, 38 insertions(+), 60 deletions(-) diff --git a/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc index 2b4dee6df9a..b42aea3b4b4 100644 --- a/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc index 01083e60168..d3ea4f405f4 100644 --- a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } #include <span> diff --git a/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc index 2f555125453..10208469cba 100644 --- a/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc @@ -1,6 +1,5 @@ -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_DEBUG #define _GLIBCXX_DEBUG diff --git a/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc index efef0e608ba..e3a3a2678c6 100644 --- a/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc @@ -1,6 +1,5 @@ -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_DEBUG #define _GLIBCXX_DEBUG diff --git a/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc index 93cd095495a..876a6b773d6 100644 --- a/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc index 4ff56bf65cf..f1d8cdccb9b 100644 --- a/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/first_neg.cc b/libstdc++-v3/testsuite/23_containers/span/first_neg.cc index 8ed68296263..4a8cd184172 100644 --- a/libstdc++-v3/testsuite/23_containers/span/first_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/first_neg.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } #include <span> diff --git a/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc index 2d4320d0fd9..12cbd4a80ae 100644 --- a/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/front_neg.cc b/libstdc++-v3/testsuite/23_containers/span/front_neg.cc index f8e8100bd7c..b5525db8f1d 100644 --- a/libstdc++-v3/testsuite/23_containers/span/front_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/front_neg.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } #include <span> diff --git a/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc index b2633cbfaab..c75924e5f38 100644 --- a/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc b/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc index 8bbe8ea0737..6e8cd4903b3 100644 --- a/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } #include <span> diff --git a/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc index 906896911c0..a464fa516b0 100644 --- a/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc index 59cd44acc3c..f36db455519 100644 --- a/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/last_neg.cc b/libstdc++-v3/testsuite/23_containers/span/last_neg.cc index 9c360d2650e..2e86233f19a 100644 --- a/libstdc++-v3/testsuite/23_containers/span/last_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/last_neg.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } #include <span> diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc index 488b5606993..12b79fffc5d 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc index 8324edfc49a..3130a503534 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc index b1dbfe6902e..2a57ddf48b8 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc index 2102fd02cce..48aaeaffbbf 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc index c003561032c..2c90c5e67f8 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc index c46b78fe8bc..4873c757996 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-do run { target c++20 xfail *-*-* } } +// { dg-add-options no_pch } #undef _GLIBCXX_ASSERTIONS #define _GLIBCXX_ASSERTIONS diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_neg.cc index 205bafd39dd..3c69f236755 100644 --- a/libstdc++-v3/testsuite/23_containers/span/subspan_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/subspan_neg.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } #include <span> diff --git a/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc b/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc index 4d363c41f7c..b9511822e19 100644 --- a/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc +++ b/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc @@ -15,9 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" } -// { dg-do run { xfail *-*-* } } -// { dg-require-effective-target c++2a } +// { dg-options "-D_GLIBCXX_ASSERTIONS" } +// { dg-do run { target c++20 xfail *-*-* } } #include <iterator> #include <testsuite_iterators.h> -- 2.41.0