]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: remove coroutines.exp
authorJason Merrill <jason@redhat.com>
Sat, 10 May 2025 15:24:38 +0000 (11:24 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 15 May 2025 21:10:58 +0000 (17:10 -0400)
coroutines.exp was basically only there to add -std=c++20 to all the tests;
removing it lets us use the general support for running tests under multiple
standards.  Doing this revealed that some tests that specifically run in
C++17 mode were relying on -std=c++20 followed by -std=c++17 leaving
flag_coroutines set, which seems unintentional, and different from how we
handle other feature flags.  So this changes that, and adds the missing
-fcoroutines to those tests.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/co-await-syntax-09-convert.C: Add -fcoroutines.
* g++.dg/coroutines/co-await-syntax-10.C
* g++.dg/coroutines/co-await-syntax-11.C
* g++.dg/coroutines/co-await-void_type.C
* g++.dg/coroutines/co-return-warning-1.C
* g++.dg/coroutines/ramp-return-a.C
* g++.dg/coroutines/ramp-return-c.C: Likewise.
* g++.dg/coroutines/coroutines.exp: Removed.
* lib/g++-dg.exp: Start at C++20 for coroutines/

gcc/c-family/ChangeLog:

* c-opts.cc (c_common_post_options): Set flag_coroutines.
(set_std_cxx20, set_std_cxx23, set_std_cxx26): Not here.

gcc/c-family/c-opts.cc
gcc/testsuite/g++.dg/coroutines/co-await-syntax-09-convert.C
gcc/testsuite/g++.dg/coroutines/co-await-syntax-10.C
gcc/testsuite/g++.dg/coroutines/co-await-syntax-11.C
gcc/testsuite/g++.dg/coroutines/co-await-void_type.C
gcc/testsuite/g++.dg/coroutines/co-return-warning-1.C
gcc/testsuite/g++.dg/coroutines/coroutines.exp [deleted file]
gcc/testsuite/g++.dg/coroutines/ramp-return-a.C
gcc/testsuite/g++.dg/coroutines/ramp-return-c.C
gcc/testsuite/lib/g++-dg.exp

index f1c276f07cdac77b6ef383603b7e7128192b3c97..697518637df3ca68e3626750c38b26e43305919b 100644 (file)
@@ -1215,6 +1215,10 @@ c_common_post_options (const char **pfilename)
   if (cxx_dialect >= cxx20)
     flag_concepts = 1;
 
+  /* Coroutines are also a C++20 feature.  */
+  SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+                      flag_coroutines, cxx_dialect >= cxx20);
+
   /* Enable lifetime extension of range based for temporaries for C++23.  */
   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
                       flag_range_for_ext_temps, cxx_dialect >= cxx23);
@@ -2009,8 +2013,6 @@ set_std_cxx20 (int iso)
   flag_isoc94 = 1;
   flag_isoc99 = 1;
   flag_isoc11 = 1;
-  /* C++20 includes coroutines. */
-  flag_coroutines = true;
   cxx_dialect = cxx20;
   lang_hooks.name = "GNU C++20";
 }
@@ -2027,8 +2029,6 @@ set_std_cxx23 (int iso)
   flag_isoc94 = 1;
   flag_isoc99 = 1;
   flag_isoc11 = 1;
-  /* C++23 includes coroutines.  */
-  flag_coroutines = true;
   cxx_dialect = cxx23;
   lang_hooks.name = "GNU C++23";
 }
@@ -2045,8 +2045,6 @@ set_std_cxx26 (int iso)
   flag_isoc94 = 1;
   flag_isoc99 = 1;
   flag_isoc11 = 1;
-  /* C++26 includes coroutines.  */
-  flag_coroutines = true;
   cxx_dialect = cxx26;
   lang_hooks.name = "GNU C++26";
 }
index dde0bab00cfd6ae2a63932e4ca25399ef14f09ec..deb3be10f07730037251184aa1fd36b2b5e660d9 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++17 -w" }
+//  { dg-additional-options "-std=c++17 -fcoroutines -w" }
 
 #include "coro.h"
 
index 8304344c826a439b793c1eab7ccc3548fb6ea50e..dfa24a81b94733dce87f3c25faa2b61f51d29805 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++17 -w" }
+//  { dg-additional-options "-std=c++17 -fcoroutines -w" }
 
 #include "coro.h"
 
index 69810ab5caaba7a8e2a4321ab5ee90216f63f83f..acee888505233e40714eb19538d92a900f9d52c3 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++17 -w" }
+//  { dg-additional-options "-std=c++17 -fcoroutines -w" }
 
 #include <utility>
 #include <type_traits>
index 370068fb5cb16d47db31e0577dd5a3e7557ae316..f35faaff8f46eccc2b4f1990e510c75cf8f30fcc 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++17 -fsyntax-only -w" }
+//  { dg-additional-options "-std=c++17 -fsyntax-only -fcoroutines -w" }
 
 #include <coroutine>
 
index b2aaba15ae35bc20c2709d438c3e0cf3589f6e9b..ef3948c3f5f8ae794458efba5a84717bacc252e9 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++17 -w" }
+//  { dg-additional-options "-std=c++17 -fcoroutines -w" }
 
 #include <coroutine>
 
diff --git a/gcc/testsuite/g++.dg/coroutines/coroutines.exp b/gcc/testsuite/g++.dg/coroutines/coroutines.exp
deleted file mode 100644 (file)
index 395e3f7..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#   Copyright (C) 2018-2025 Free Software Foundation, Inc.
-
-# Contributed by Iain Sandoe <iain@sandoe.co.uk> under contract to Facebook.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# Test C++ coroutines, requires c++17; doesn't, at present, seem much 
-# point in repeating these for other versions.
-
-# Load support procs.
-load_lib g++-dg.exp
-
-# If a testcase doesn't have special options, use these.
-global DEFAULT_CXXFLAGS
-if ![info exists DEFAULT_CXXFLAGS] then {
-    set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long"
-}
-
-set DEFAULT_COROFLAGS $DEFAULT_CXXFLAGS
-lappend DEFAULT_COROFLAGS "-std=c++20"
-
-dg-init
-
-# Run the tests.
-# g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \
-#        "" $DEFAULT_COROFLAGS
-
-foreach test [lsort [find $srcdir/$subdir {*.[CH]}]] {
-    if [runtest_file_p $runtests $test] {
-        set nshort [file tail [file dirname $test]]/[file tail $test]
-        verbose "Testing $nshort $DEFAULT_COROFLAGS" 1
-        dg-test $test "" $DEFAULT_COROFLAGS
-        set testcase [string range $test [string length "$srcdir/"] end]
-    }
-}
-
-# done.
-dg-finish
index fcea6f9975f8f912903cdee2f1b9f228e83230e5..543f92fdb289f7e619c95a7e814051ac185a2168 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++14" }
+//  { dg-additional-options "-std=c++14 -fcoroutines" }
 //  { dg-skip-if "requires hosted libstdc++ for vector in ramp-return.h" { ! hostedlib } }
 
 #include "ramp-return.h"
index 0992924b434312b3ba352c109491f3be84f48cdd..d5ea3f9491d8f3fc118743d3161d0215b1dd58c4 100644 (file)
@@ -1,4 +1,4 @@
-//  { dg-additional-options "-std=c++17" }
+//  { dg-additional-options "-std=c++17 -fcoroutines" }
 //  { dg-skip-if "requires hosted libstdc++ for vector in ramp-return.h" { ! hostedlib } }
 #define DELETE_COPY_CTOR 1
 #include "ramp-return.h"
index eb7a9714bc4dc26a73e1b007ed711eed36e01bca..042a9171c7563d09e02f4ab5af2102812c251c23 100644 (file)
@@ -41,6 +41,7 @@ proc g++-std-flags { test } {
 
        set low 0
        # Some directories expect certain minimums.
+       if { [string match "*/coroutines/*" $test] } { set low 20 }
        if { [string match "*/modules/*" $test] } { set low 17 }
 
        # See g++.exp for the initial value of this list.