Re: [PATCH] coroutines, libstdc++-v3: Update headers to n4861 C++20 DIS.

2020-04-22 Thread Jonathan Wakely via Gcc-patches

On 22/04/20 19:44 +0100, Iain Sandoe wrote:

Hi,

this is a bit of ‘housekeeping’ bringing the coroutines library header into
line with the C++20 DIS.

Note that we allow coroutines on C++14+ (probably they would work on
C++11 too, but that’s untested).  So the  header reflects this by
exporting the __cpp_lib_coroutine define from then,

Tested on x86_64-darwin16 so far,
OK for master after regstrap on x86_64-Linux?
thanks
Iain

=

Add '__cpp_lib_coroutine' defined to 201902L per n4861 to 
Likewise to 

Update the inline namespace to __n4861.

libstdc++-v3/ChangeLog:

2020-04-22  Iain Sandoe  

* include/std/coroutine: Update the inline namespace to __n4861.
Add the __cpp_lib_coroutine define, set to 201902L.
* include/std/version: Add __cpp_lib_coroutine, set to 201902L.


The libstdc++ parts are OK, and I suppose the testsuite changes don't
really need approval because they follow from the libstdc++ parts and
so are "obvious".

Thanks.




[PATCH] coroutines, libstdc++-v3: Update headers to n4861 C++20 DIS.

2020-04-22 Thread Iain Sandoe
Hi,

this is a bit of ‘housekeeping’ bringing the coroutines library header into
line with the C++20 DIS.

Note that we allow coroutines on C++14+ (probably they would work on
C++11 too, but that’s untested).  So the  header reflects this by
exporting the __cpp_lib_coroutine define from then,

Tested on x86_64-darwin16 so far,
OK for master after regstrap on x86_64-Linux?
thanks
Iain

=

Add '__cpp_lib_coroutine' defined to 201902L per n4861 to 
Likewise to 

Update the inline namespace to __n4861.

libstdc++-v3/ChangeLog:

2020-04-22  Iain Sandoe  

* include/std/coroutine: Update the inline namespace to __n4861.
Add the __cpp_lib_coroutine define, set to 201902L.
* include/std/version: Add __cpp_lib_coroutine, set to 201902L.

gcc/testsuite/ChangeLog:

2020-04-22  Iain Sandoe  

* g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C: Adjust for
changed inline namespace.
* g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C: Likewise.
* g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C: Likewise
* g++.dg/coroutines/coro.h: Likewise
---
 .../g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C | 2 +-
 .../g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C | 2 +-
 .../g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C   | 2 +-
 gcc/testsuite/g++.dg/coroutines/coro.h   | 4 ++--
 libstdc++-v3/include/std/coroutine   | 9 ++---
 libstdc++-v3/include/std/version | 3 +++
 6 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C 
b/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C
index 1fdce1dad1d..06543a98824 100644
--- a/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C
+++ b/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C
@@ -6,7 +6,7 @@
 #include "coro1-allocators.h"
 
 struct coro1
-f ()  /* { dg-error {'operator new' is provided by 
'std::__n4835::coroutine_traits::promise_type' \{aka 
'coro1::promise_type'\} but is not usable with the function signature 'coro1 
f\(\)'} } */
+f ()  /* { dg-error {'operator new' is provided by 
'std::__n4861::coroutine_traits::promise_type' \{aka 
'coro1::promise_type'\} but is not usable with the function signature 'coro1 
f\(\)'} } */
 {
   co_return;
 }
diff --git a/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C 
b/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C
index be804796835..9a4ec34cdf3 100644
--- a/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C
+++ b/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C
@@ -6,7 +6,7 @@
 #include "coro1-allocators.h"
 
 struct coro1
-f ()  /* { dg-error {'operator delete' is provided by 
'std::__n4835::coroutine_traits::promise_type' \{aka 
'coro1::promise_type'\} but is not usable with the function signature 'coro1 
f\(\)'} } */
+f ()  /* { dg-error {'operator delete' is provided by 
'std::__n4861::coroutine_traits::promise_type' \{aka 
'coro1::promise_type'\} but is not usable with the function signature 'coro1 
f\(\)'} } */
 {
   co_return;
 }
diff --git a/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C 
b/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C
index eae2dada911..c0c0792d31d 100644
--- a/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C
+++ b/gcc/testsuite/g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C
@@ -9,7 +9,7 @@
 #include "coro1-allocators.h"
 
 struct coro1
-f () /* { dg-error 
{'coro1::promise_type::get_return_object_on_allocation_failure\(\)\(\)' is 
provided by 'std::__n4835::coroutine_traits::promise_type' \{aka 
'coro1::promise_type'\} but 'operator new' is not marked 'throw\(\)' or 
'noexcept'} } */
+f () /* { dg-error 
{'coro1::promise_type::get_return_object_on_allocation_failure\(\)\(\)' is 
provided by 'std::__n4861::coroutine_traits::promise_type' \{aka 
'coro1::promise_type'\} but 'operator new' is not marked 'throw\(\)' or 
'noexcept'} } */
 {
   co_return;
 }
diff --git a/gcc/testsuite/g++.dg/coroutines/coro.h 
b/gcc/testsuite/g++.dg/coroutines/coro.h
index a1bd38b8d12..fccfe418616 100644
--- a/gcc/testsuite/g++.dg/coroutines/coro.h
+++ b/gcc/testsuite/g++.dg/coroutines/coro.h
@@ -32,7 +32,7 @@ namespace coro = std::experimental;
 #  if __cpp_impl_coroutine
 
 namespace std {
-inline namespace __n4835 {
+inline namespace __n4861 {
 
 // 21.11.1 coroutine traits
 template struct coroutine_traits {
@@ -125,7 +125,7 @@ struct suspend_never {
   void await_resume() {}
 };
 
-} // namespace __n4835
+} // namespace __n4861
 } // namespace std
 
 namespace coro = std;
diff --git a/libstdc++-v3/include/std/coroutine 
b/libstdc++-v3/include/std/coroutine
index 2e45c451450..4fa1355c0ca 100644
--- a/libstdc++-v3/include/std/coroutine
+++ b/libstdc++-v3/include/std/coroutine
@@ -52,10 +52,13 @@
 
 namespace std _GLIBCXX_VISIBILITY (default)
 {
-