aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-05-15 17:59:49 -0400
committerJason Merrill <jason@redhat.com>2020-05-15 17:59:49 -0400
commit29f0e90d9904d8e0965443d4da4c95ddde5edb1e (patch)
treebfa05c25f3204db05cd5eb7e94c5814cf284f204
parent16485ea97b3d9856a9387d858ca455889e97bf30 (diff)
downloadgcc-29f0e90d9904d8e0965443d4da4c95ddde5edb1e.zip
gcc-29f0e90d9904d8e0965443d4da4c95ddde5edb1e.tar.gz
gcc-29f0e90d9904d8e0965443d4da4c95ddde5edb1e.tar.bz2
c++: Enable coroutines with -std=c++20.
Now that GCC 10 is out it seems time. People can still choose to disable coroutines with -fno-coroutines. This also switches the coroutines testsuite to run in C++20 mode. The change to coro.h is only necessary for co-await-11-forwarding.C; we could alternatively #include <utility> just in that file. gcc/c-family/ChangeLog 2020-05-15 Jason Merrill <jason@redhat.com> * c-opts.c (set_std_cxx20): Set flag_coroutines. gcc/testsuite/ChangeLog 2020-05-15 Jason Merrill <jason@redhat.com> * g++.dg/coroutines/coro.h: Always #include <utility>. * g++.dg/coroutines/coroutines.exp (DEFAULT_COROFLAGS): Use -std=c++20.
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c-opts.c7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/coroutines/coro.h10
-rw-r--r--gcc/testsuite/g++.dg/coroutines/coroutines.exp2
5 files changed, 17 insertions, 12 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7bd78c0..da4be41 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,7 @@
+2020-05-15 Jason Merrill <jason@redhat.com>
+
+ * c-opts.c (set_std_cxx20): Set flag_coroutines.
+
2020-05-13 Jason Merrill <jason@redhat.com>
* c.opt (std=c++20): Make c++2a the alias.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index bd617d3..7695e88 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1722,7 +1722,7 @@ set_std_cxx17 (int iso)
lang_hooks.name = "GNU C++17";
}
-/* Set the C++ 202a draft standard (without GNU extensions if ISO). */
+/* Set the C++ 2020 standard (without GNU extensions if ISO). */
static void
set_std_cxx20 (int iso)
{
@@ -1734,9 +1734,10 @@ set_std_cxx20 (int iso)
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
- /* C++20 includes concepts. */
+ /* C++20 includes coroutines. */
+ flag_coroutines = true;
cxx_dialect = cxx20;
- lang_hooks.name = "GNU C++17"; /* Pretend C++17 until standardization. */
+ lang_hooks.name = "GNU C++20";
}
/* Args to -d specify what to dump. Silently ignore
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fb93dbb..875ac82 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-15 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/coroutines/coro.h: Always #include <utility>.
+ * g++.dg/coroutines/coroutines.exp (DEFAULT_COROFLAGS): Use
+ -std=c++20.
+
2020-05-15 Segher Boessenkool <segher@kernel.crashing.org>
* gcc.target/powerpc/vec-gnb-0.c: Use int128 effective target.
diff --git a/gcc/testsuite/g++.dg/coroutines/coro.h b/gcc/testsuite/g++.dg/coroutines/coro.h
index fccfe41..02d2660 100644
--- a/gcc/testsuite/g++.dg/coroutines/coro.h
+++ b/gcc/testsuite/g++.dg/coroutines/coro.h
@@ -2,20 +2,12 @@
#include <coroutine>
-# if __clang__
-# include <utility>
-# endif
-
namespace coro = std;
#elif __has_include(<experimental/coroutine>)
#include <experimental/coroutine>
-# if __clang__
-# include <utility>
-# endif
-
namespace coro = std::experimental;
#else
@@ -143,6 +135,8 @@ extern "C" int printf (const char *, ...);
#include <cstdlib> /* for abort () */
+#include <utility> /* for std::forward */
+
#ifndef OUTPUT
# define PRINT(X)
# define PRINTF (void)
diff --git a/gcc/testsuite/g++.dg/coroutines/coroutines.exp b/gcc/testsuite/g++.dg/coroutines/coroutines.exp
index e7fd4da..1bef98a 100644
--- a/gcc/testsuite/g++.dg/coroutines/coroutines.exp
+++ b/gcc/testsuite/g++.dg/coroutines/coroutines.exp
@@ -29,7 +29,7 @@ if ![info exists DEFAULT_CXXFLAGS] then {
}
set DEFAULT_COROFLAGS $DEFAULT_CXXFLAGS
-lappend DEFAULT_COROFLAGS "-std=c++17" "-fcoroutines"
+lappend DEFAULT_COROFLAGS "-std=c++20"
dg-init