From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3335E3858284 for ; Tue, 30 Aug 2022 12:20:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3335E3858284 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661862022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DN9epDjrIvC9qiea7wOuNcry49B0C7GZCirWKoxjZn4=; b=USkWYU535pC5SFrRfTAp/J6g6RpKb62y9QKcJymATu6hR0Txc51h/xryuVdJyZoeCF5xEC +VvRUlpA/PduNIPlUaeqWmknyTLfYHsIiKxH+li3ybDjs2G9Iq42Mibnk9YhWWPIs4rVC6 nFuefwBd1Fd7SEMe3c7lYCwMLk7F5mY= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-147-mWkFibljMvWehqXZPqmAJg-1; Tue, 30 Aug 2022 08:20:21 -0400 X-MC-Unique: mWkFibljMvWehqXZPqmAJg-1 Received: by mail-qk1-f199.google.com with SMTP id bl16-20020a05620a1a9000b006bc3aa1908dso9019443qkb.15 for ; Tue, 30 Aug 2022 05:20:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=DN9epDjrIvC9qiea7wOuNcry49B0C7GZCirWKoxjZn4=; b=P2cQ+lk3EljgFpSgXQKY1Z/MbMHHqPabTRbBx9ASSr+K3tMkYoI64h06k0n3SxYpzG iFv7a+o/o7lDZ5FsrDtSb7cooF7st8ThQlAzN9I2R9dpEaR9TquNDVHR8owg6VYcP2t1 8q5W0HtNuUQ7Qlad6pw1kcTX9kuOfjGg6BGIxnKYmOAiCR3SRYohuxenO8qlfD1c0eW/ iK/GT8kYLQXGhXACcZrk5cqhStdwINl/zSXIK8hgtcWbAZ/NugZiyVdlag8xJob2iBGb Wz3k9x4YnNGuPbHd8uHqvl8Vj81dV/4uJtOglLYORH3YxzEILlK7Za7YxOuVEOWBUJY3 KzBA== X-Gm-Message-State: ACgBeo3/LDVIVliJ0CJuMi9VlTBaMXFyaHB+Gg31X5SuluoOeD5rl90f jlW5YZBXJ0qAzYQKPX0WDAkqX5u+NQ60DuzxsAisE40oi30XQIY9IQYPsJACAGBhN6zZ7bko4ba UHPSQZrr0fJBku7Q33w== X-Received: by 2002:a05:620a:4308:b0:6bc:5ba:c4ea with SMTP id u8-20020a05620a430800b006bc05bac4eamr11602810qko.357.1661862020652; Tue, 30 Aug 2022 05:20:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR42OWsga21blxVLOrK2cwnCLsjBDHyUhXg1BsJHfoz2TYS5NWuyuqYSgQvNKhnihStCpdBrEg== X-Received: by 2002:a05:620a:4308:b0:6bc:5ba:c4ea with SMTP id u8-20020a05620a430800b006bc05bac4eamr11602796qko.357.1661862020362; Tue, 30 Aug 2022 05:20:20 -0700 (PDT) Received: from redhat.com ([2601:184:4780:4310::e531]) by smtp.gmail.com with ESMTPSA id bl14-20020a05620a1a8e00b006b953a7929csm7681896qkb.73.2022.08.30.05.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 05:20:19 -0700 (PDT) Date: Tue, 30 Aug 2022 08:20:17 -0400 From: Marek Polacek To: Nathan Sidwell Cc: GCC Patches , Jason Merrill Subject: Re: C++: add -std={c,gnu}++{current,future} Message-ID: References: <045690d0-9a3a-13c9-61d8-6e2c54d53fc7@acm.org> MIME-Version: 1.0 In-Reply-To: <045690d0-9a3a-13c9-61d8-6e2c54d53fc7@acm.org> User-Agent: Mutt/2.2.6 (2022-06-05) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-12.9 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_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jul 13, 2022 at 03:29:04PM -0400, Nathan Sidwell via Gcc-patches wrote: > Inspired by a user question. Jason, thoughts? FWIW, this makes sense. I mean, how could I be against a patch quoting Macbeth?! > Since C++ is such a moving target, Microsoft have /std:c++latest > (AFAICT clang does not), to select the currently implemented version > of the working paper. But the use of 'std:latest' is somewhat > ambiguous -- the current std is C++20 -- that's the latest std, the > next std will more than likely but not necessarily be C++23. So this > adds: > > -std=c++current -- the current std (c++20) > -std=c++future -- the working paper (c++2b) > > also adds gnu++current and gnu++future to select the gnu-extended > variants. > > nathan > > -- > Nathan Sidwell > From 9671f4d5e7efa130280b6d50fb4e9e8492d5b587 Mon Sep 17 00:00:00 2001 > From: Nathan Sidwell > Date: Wed, 13 Jul 2022 12:11:40 -0700 > Subject: [PATCH] C++: add -std={c,gnu}++{current,future} > > Since C++ is such a moving target, Microsoft have /std:c++latest > (AFAICT clang does not), to select the currently implemented version > of the working paper. But the use of 'std:latest' is somewhat > ambiguous -- the current std is C++20 -- that's the latest std, the > next std will more than likely but not necessarily be C++23. So this > adds: > > -std=c++current -- the current std (c++20) > -std=c++future -- the working paper (c++2b) > > also adds gnu++current and gnu++future to select the gnu-extended > variants. > > gcc/ > * doc/invoke.texi (-std=): Document new c++ current & future > options. > gcc/c-family/ > * c.opt (-std={c,gnu}++{current,future}: New alias options. > gcc/testsuite/ > * g++.dg/gnu-current.C: New. > * g++.dg/gnu-future.C: New. > * g++.dg/std-current.C: New. > * g++.dg/std-future.C: New. > --- > gcc/c-family/c.opt | 16 ++++++++++++++++ > gcc/doc/invoke.texi | 23 +++++++++++++++++++++++ > gcc/testsuite/g++.dg/gnu-current.C | 7 +++++++ > gcc/testsuite/g++.dg/gnu-future.C | 7 +++++++ > gcc/testsuite/g++.dg/std-current.C | 11 +++++++++++ > gcc/testsuite/g++.dg/std-future.C | 8 ++++++++ > 6 files changed, 72 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/gnu-current.C > create mode 100644 gcc/testsuite/g++.dg/gnu-future.C > create mode 100644 gcc/testsuite/g++.dg/std-current.C > create mode 100644 gcc/testsuite/g++.dg/std-future.C > > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt > index 44e1a60ce24..9292029a967 100644 > --- a/gcc/c-family/c.opt > +++ b/gcc/c-family/c.opt > @@ -2321,6 +2321,14 @@ std=c++23 > C++ ObjC++ Undocumented > Conform to the ISO 2023 C++ draft standard (experimental and incomplete support). > > +std=c++current > +C++ ObjC++ Alias(std=c++20) Undocumented > +Conform to the current ISO C++ standard (C++20). > + > +std=c++future > +C++ ObjC++ Alias(std=c++23) Undocumented > +Conform to a future ISO C++ standard (C++2b, experimentatl and incomplete support). Since the option says 23, why not use 23 here as well instead of 2b? And below too. > + > std=c11 > C ObjC > Conform to the ISO 2011 C standard. > @@ -2407,6 +2415,14 @@ std=gnu++23 > C++ ObjC++ Undocumented > Conform to the ISO 2023 C++ draft standard with GNU extensions (experimental and incomplete support). > > +std=gnu++current > +C++ ObjC++ Alias(std=gnu++20) Undocumented > +Conform to the current ISO C++ standard with GNU extensions (C++20). > + > +std=gnu++future > +C++ ObjC++ Alias(std=gnu++23) Undocumented > +Conform to a future ISO C++ standard with GNU extensions (C++2b, experimentatl and incomplete support). > + > std=gnu11 > C ObjC > Conform to the ISO 2011 C standard with GNU extensions. > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index d5ff1018372..1c0edb9df68 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -2462,6 +2462,17 @@ GNU dialect of @option{-std=c++17}. > This is the default for C++ code. > The name @samp{gnu++1z} is deprecated. > > +@item gnu++current > +@itemx gnu++current > +GNU dialect of the current C++ standard, currently @option{-std=gnu++20}. > +The C++ version selected by this option is a moving target. > + > +@item gnu++future > +@itemx gnu++future > +GNU dialect of the next C++ standard, currently @option{-std=gnu++2b}. > +The C++ version selected by this option is a moving target (as are the > +semantics of that proposed version). > + > @item c++20 > @itemx c++2a > The 2020 ISO C++ standard plus amendments. > @@ -2487,6 +2498,18 @@ change in incompatible ways in future releases. > GNU dialect of @option{-std=c++2b}. Support is highly experimental, > and will almost certainly change in incompatible ways in future > releases. > + > +@item c++current > +@itemx c++current > +The current C++ standard, currently @option{-std=gnu++20}. > +The C++ version selected by this option is a moving target. > + > +@item c++future > +@itemx c++future > +The next C++ standard, currently @option{-std=gnu++2b}. > +The C++ version selected by this option is a moving target (as are the > +semantics of that proposed version). > + > @end table > > @item -aux-info @var{filename} > diff --git a/gcc/testsuite/g++.dg/gnu-current.C b/gcc/testsuite/g++.dg/gnu-current.C > new file mode 100644 > index 00000000000..c95c56d3ad8 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/gnu-current.C > @@ -0,0 +1,7 @@ > +// { dg-do compile } > +// { dg-options -std=gnu++current } > + > +static_assert (__cplusplus == 202002L, "time has moved on"); > +#if __STRICT_ANSI__ > +#error "__STRICT_ANSI__ surprisingly non-zero" > +#endif > diff --git a/gcc/testsuite/g++.dg/gnu-future.C b/gcc/testsuite/g++.dg/gnu-future.C > new file mode 100644 > index 00000000000..366dcdeebc2 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/gnu-future.C > @@ -0,0 +1,7 @@ > +// { dg-do compile } > +// { dg-options -std=gnu++future } > + > +static_assert (__cplusplus > 202002L, "time has moved on"); > +#if __STRICT_ANSI__ > +#error "__STRICT_ANSI__ surprisingly non-zero" > +#endif > diff --git a/gcc/testsuite/g++.dg/std-current.C b/gcc/testsuite/g++.dg/std-current.C > new file mode 100644 > index 00000000000..334ffd1d2c4 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/std-current.C > @@ -0,0 +1,11 @@ > +// { dg-do compile } > +// { dg-options -std=c++current } > + > +// Adust as tomorrow and tomorrow and tomorrow > +// Creeps in this petty pace from day to day > +// To the last syllable of recorded time. > + > +static_assert (__cplusplus == 202002L, "time has moved on"); > +#if !__STRICT_ANSI__ > +#error "__STRICT_ANSI__ surprisingly zero" > +#endif > diff --git a/gcc/testsuite/g++.dg/std-future.C b/gcc/testsuite/g++.dg/std-future.C > new file mode 100644 > index 00000000000..dade97e6a71 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/std-future.C > @@ -0,0 +1,8 @@ > +// { dg-do compile } > +// { dg-options -std=c++future } > + > +static_assert (__cplusplus > 202002L, "time has moved on"); > +#if !__STRICT_ANSI__ > +#error "__STRICT_ANSI__ surprisingly zero" > +#endif > + > -- > 2.30.2 > Marek