From patchwork Wed Apr 22 18:44:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1275367 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 496q9c4WnJz9sSk for ; Thu, 23 Apr 2020 04:44:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4681D3952027; Wed, 22 Apr 2020 18:44:49 +0000 (GMT) X-Original-To: GCC-patches@gcc.gnu.org Delivered-To: GCC-patches@gcc.gnu.org Received: from smtp1.wavenetuk.net (smtp.wavenetuk.net [195.26.36.10]) by sourceware.org (Postfix) with ESMTP id 48AAA3952003; Wed, 22 Apr 2020 18:44:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48AAA3952003 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=iain@sandoe.co.uk Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp1.wavenetuk.net (Postfix) with ESMTPA id 5AB071200B77; Wed, 22 Apr 2020 19:44:44 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] coroutines, libstdc++-v3: Update headers to n4861 C++20 DIS. Message-Id: <952D0395-713F-48ED-B6FF-DDB5D74DA632@sandoe.co.uk> Date: Wed, 22 Apr 2020 19:44:40 +0100 To: libstdc++ , GCC-patches@gcc.gnu.org X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jonathan Wakely Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 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) { - _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cpp_impl_coroutine - inline namespace __n4835 { + +#define __cpp_lib_coroutine 201902L + + inline namespace __n4861 { // 17.12.2 coroutine traits /// [coroutine.traits] @@ -277,7 +280,7 @@ namespace std _GLIBCXX_VISIBILITY (default) void await_resume() {} }; - } // namespace __n4835 + } // namespace __n4861 #else #error "the coroutine header requires -fcoroutines" diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index 6d7dcc46023..9ec987777e9 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -69,6 +69,9 @@ #if __cplusplus >= 201402L // c++14 +#if __cpp_impl_coroutine +# define __cpp_lib_coroutine 201902L +#endif #define __cpp_lib_integral_constant_callable 201304 #define __cpp_lib_is_final 201402L #define __cpp_lib_transformation_trait_aliases 201304