From patchwork Thu May 14 20:41:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1290699 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=qcHZOcZP; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 49NNkR4vDXz9sTC for ; Fri, 15 May 2020 06:41:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B71193840C2B; Thu, 14 May 2020 20:41:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B71193840C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589488909; bh=pqEO38hhFchMnaJINXBwpoJnebc9scnuOmnqN8Tzpmg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=qcHZOcZPLoA49fAUQbviq3pZ24dYWZoaZ518xMdd/Hh7qGCOLnGLlKjdcuM8T+yYr Lq0NRppGfi4+iWTAQHbRfB5gVJdVj3Je1alHGZexh/sUP2Xuw0L2qTxk7jenzThvbG MM1cWE4BWyEo7KWL7HYQsBbp3Vc+CuxUCZspTwnQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 51ACE3851C39 for ; Thu, 14 May 2020 20:41:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 51ACE3851C39 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-iydRxO0EMV2YADR26EAriw-1; Thu, 14 May 2020 16:41:34 -0400 X-MC-Unique: iydRxO0EMV2YADR26EAriw-1 Received: by mail-qk1-f197.google.com with SMTP id 14so4338316qkv.16 for ; Thu, 14 May 2020 13:41:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pqEO38hhFchMnaJINXBwpoJnebc9scnuOmnqN8Tzpmg=; b=PyH1ZKpSNdL0eNMujDPePuCmrgrek6qZmh/xA5KzWKs/+1+r0beai/m0RY95dKlUZf Lw+J/RlktFOnxK3OBULgiGWQBrx8bmzlt6yy1+Mn35DaO4ir0g0056gikV/KJPdlpYGS 3pAY3HQAVcOXhWq3bo55fUbXbulrE+7X5xK6VsTr65IZEQJc0dczN4FsrWHqSe+73yrR xURItqzEU0ZI67zteatX8ptfZcv6BXpygf8Gv20kr7DgUzyv/jw51vAIFayJhfFsF++Y X4wlrEmdC+56GOcNVVhUeZxEaLQhkmdqkRRVG+K30Ww8PuVyOmss4o2SHnKmut3wkk6C rCxQ== X-Gm-Message-State: AOAM531uksVwuhpwvcS0iQitBHYAlYpUO+rlemPeq6/RM2uvFTl8R1sA wu6lanFzvW7mzRuMRrZs365QgcPCfoS+Lb3ujYpNh5jvhRCUwcZ3tJizD2S7EI5GTdJUGfwsuYH 2XUjMaOIGDniZeVbIsg== X-Received: by 2002:a37:4895:: with SMTP id v143mr197527qka.101.1589488893437; Thu, 14 May 2020 13:41:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxACfcdDAzfMisznKX4zj9pn9x3fiLw5iGjTjs4YChXM8yMU0RLTV8k9NULBaYMNqGi4vVbZQ== X-Received: by 2002:a37:4895:: with SMTP id v143mr197505qka.101.1589488893068; Thu, 14 May 2020 13:41:33 -0700 (PDT) Received: from barrymore.redhat.com (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id x124sm494qkb.108.2020.05.14.13.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 13:41:32 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: Enable coroutines with -std=c++20. Date: Thu, 14 May 2020 16:41:23 -0400 Message-Id: <20200514204123.1886-1-jason@redhat.com> X-Mailer: git-send-email 2.18.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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: , X-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Cc: Iain Sandoe Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 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 needed for co-await-11-forwarding.C; we could alternatively #include just in that file. Iain, does this make sense to you? gcc/c-family/ChangeLog 2020-05-14 Jason Merrill * c-opts.c (set_std_cxx20): Set flag_coroutines. gcc/testsuite/ChangeLog 2020-05-14 Jason Merrill * g++.dg/coroutines/coro.h: Always #include . * g++.dg/coroutines/coroutines.exp (DEFAULT_COROFLAGS): Use -std=c++20. --- gcc/testsuite/g++.dg/coroutines/coro.h | 10 ++-------- gcc/c-family/c-opts.c | 7 ++++--- gcc/testsuite/g++.dg/coroutines/coroutines.exp | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) base-commit: 4e1592f8e1d6366699e05c0824fc3dc39ca7314b diff --git a/gcc/testsuite/g++.dg/coroutines/coro.h b/gcc/testsuite/g++.dg/coroutines/coro.h index fccfe418616..02d26602727 100644 --- a/gcc/testsuite/g++.dg/coroutines/coro.h +++ b/gcc/testsuite/g++.dg/coroutines/coro.h @@ -2,20 +2,12 @@ #include -# if __clang__ -# include -# endif - namespace coro = std; #elif __has_include() #include -# if __clang__ -# include -# endif - namespace coro = std::experimental; #else @@ -143,6 +135,8 @@ extern "C" int printf (const char *, ...); #include /* for abort () */ +#include /* for std::forward */ + #ifndef OUTPUT # define PRINT(X) # define PRINTF (void) diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index bd617d3df18..7695e88c130 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/g++.dg/coroutines/coroutines.exp b/gcc/testsuite/g++.dg/coroutines/coroutines.exp index e7fd4dac461..1bef98ae54d 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