* [committed] c++: Add -std=c++20.
@ 2020-02-15 21:22 Jason Merrill
2020-02-18 1:14 ` [PATCH] c++: use "C++20" in std header hints David Malcolm
0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2020-02-15 21:22 UTC (permalink / raw)
To: gcc-patches
It's probably past time for this, but definitely now that we're done with
the final committee meeting of C++20. This patch only adds the option and
adjusts the testsuite to recognize it; more extensive changes can wait for
the published standard.
Tested x86_64-pc-linux-gnu, applying to trunk.
gcc/ChangeLog
2020-02-15 Jason Merrill <jason@redhat.com>
* doc/invoke.texi (C Dialect Options): Add -std=c++20.
gcc/c-family/ChangeLog
2020-02-15 Jason Merrill <jason@redhat.com>
* c.opt: Add -std=c++20.
gcc/testsuite/ChangeLog
2020-02-15 Jason Merrill <jason@redhat.com>
* lib/target-supports.exp (check_effective_target_c++2a_only): Also
look for -std=*++20.
(check_effective_target_concepts): Use check_effective_target_c++2a.
---
gcc/doc/invoke.texi | 10 ++++++----
gcc/c-family/c.opt | 6 +++++-
gcc/testsuite/lib/target-supports.exp | 9 ++++++---
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 597151670be..3e47d06f0d5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2078,13 +2078,15 @@ The name @samp{c++1z} is deprecated.
GNU dialect of @option{-std=c++17}.
The name @samp{gnu++1z} is deprecated.
-@item c++2a
-The next revision of the ISO C++ standard, tentatively planned for
+@item c++20
+@itemx c++2a
+The next revision of the ISO C++ standard, planned for
2020. Support is highly experimental, and will almost certainly
change in incompatible ways in future releases.
-@item gnu++2a
-GNU dialect of @option{-std=c++2a}. Support is highly experimental,
+@item gnu++20
+@itemx gnu++2a
+GNU dialect of @option{-std=c++20}. Support is highly experimental,
and will almost certainly change in incompatible ways in future
releases.
@end table
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 814ed17f7c4..b7e4fe146b2 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -2071,7 +2071,11 @@ Conform to the ISO 2017 C++ standard.
std=c++2a
C++ ObjC++
-Conform to the ISO 2020(?) C++ draft standard (experimental and incomplete support).
+Conform to the ISO 2020 C++ draft standard (experimental and incomplete support).
+
+std=c++20
+C++ ObjC++ Alias(std=c++2a)
+Conform to the ISO 2020 C++ draft standard (experimental and incomplete support).
std=c11
C ObjC
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index fb177c54aa8..ec462315860 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8806,7 +8806,7 @@ proc check_effective_target_c++2a_only { } {
if ![check_effective_target_c++] {
return 0
}
- if [check-flags { { } { } { -std=c++2a -std=gnu++2a } }] {
+ if [check-flags { { } { } { -std=c++2a -std=gnu++2a -std=c++20 -std=gnu++20 } }] {
return 1
}
if { $cxx_default == "c++20" && [check-flags { { } { } { } { -std=* } }] } {
@@ -8818,9 +8818,12 @@ proc check_effective_target_c++2a { } {
return [check_effective_target_c++2a_only]
}
-# Check for C++ Concepts TS support, i.e. -fconcepts flag.
+# Check for C++ Concepts support, i.e. -fconcepts flag.
proc check_effective_target_concepts { } {
- return [check-flags { "" { } { -fconcepts -std=*2a } }]
+ if [check_effective_target_c++2a] {
+ return 1
+ }
+ return [check-flags { "" { } { -fconcepts } }]
}
# Return 1 if expensive testcases should be run.
base-commit: 0b3c2eed35d608d6541ecf004a9576b4eae0b4ef
--
2.18.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] c++: use "C++20" in std header hints
2020-02-15 21:22 [committed] c++: Add -std=c++20 Jason Merrill
@ 2020-02-18 1:14 ` David Malcolm
2020-02-19 23:55 ` Jason Merrill
0 siblings, 1 reply; 3+ messages in thread
From: David Malcolm @ 2020-02-18 1:14 UTC (permalink / raw)
To: Jason Merrill, gcc-patches; +Cc: David Malcolm
On Sat, 2020-02-15 at 22:21 +0100, Jason Merrill wrote:
> It's probably past time for this, but definitely now that we're done
> with
> the final committee meeting of C++20. This patch only adds the
> option and
> adjusts the testsuite to recognize it; more extensive changes can
> wait for
> the published standard.
I don't know if this is premature, or too piecemeal, but this patch
improves hints such as:
note: 'std::source_location' is only available from C++2a onwards
to
note: 'std::source_location' is only available from C++20 onwards
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
OK for master?
gcc/cp/ChangeLog:
* name-lookup.c (get_cxx_dialect_name): Return "C++20" for cxx2a.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/missing-std-include-8.C: Add test coverage for
C++20 hints.
---
gcc/cp/name-lookup.c | 2 +-
gcc/testsuite/g++.dg/lookup/missing-std-include-8.C | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e5638d2df91..7a87c3d2eb5 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5856,7 +5856,7 @@ get_cxx_dialect_name (enum cxx_dialect dialect)
case cxx17:
return "C++17";
case cxx2a:
- return "C++2a";
+ return "C++20";
}
}
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
index 73532c82968..716479761b4 100644
--- a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
@@ -43,6 +43,10 @@ std::shared_timed_mutex m; // { dg-error "'shared_timed_mutex' in namespace 'std
std::string_view sv; // { dg-error "'string_view' in namespace 'std' does not name a type" }
// { dg-message "'std::string_view' is only available from C\\+\\+17 onwards" "" { target *-*-* } .-1 }
+/* Since C++20: */
+std::source_location loc; // { dg-error "'source_location' in namespace 'std' does not name a type" }
+// { dg-message "'std::source_location' is only available from C\\+\\+20 onwards" "" { target *-*-* } .-1 }
+
/* Verify interaction with "using namespace std;". */
using namespace std;
void test_via_using_directive ()
--
2.21.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] c++: use "C++20" in std header hints
2020-02-18 1:14 ` [PATCH] c++: use "C++20" in std header hints David Malcolm
@ 2020-02-19 23:55 ` Jason Merrill
0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2020-02-19 23:55 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 2/18/20 2:14 AM, David Malcolm wrote:
> On Sat, 2020-02-15 at 22:21 +0100, Jason Merrill wrote:
>> It's probably past time for this, but definitely now that we're done
>> with
>> the final committee meeting of C++20. This patch only adds the
>> option and
>> adjusts the testsuite to recognize it; more extensive changes can
>> wait for
>> the published standard.
>
> I don't know if this is premature, or too piecemeal, but this patch
> improves hints such as:
> note: 'std::source_location' is only available from C++2a onwards
> to
> note: 'std::source_location' is only available from C++20 onwards
>
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
>
> OK for master?
Why change this in just this one place?
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-19 23:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-15 21:22 [committed] c++: Add -std=c++20 Jason Merrill
2020-02-18 1:14 ` [PATCH] c++: use "C++20" in std header hints David Malcolm
2020-02-19 23:55 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).