From fb26050409473f5be54465beca114b7e48de43aa Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 15 Feb 2020 16:20:46 +0100 Subject: [PATCH] c++: Add -std=c++20. 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. gcc/ChangeLog 2020-02-15 Jason Merrill * doc/invoke.texi (C Dialect Options): Add -std=c++20. gcc/c-family/ChangeLog 2020-02-15 Jason Merrill * c.opt: Add -std=c++20. gcc/testsuite/ChangeLog 2020-02-15 Jason Merrill * 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/ChangeLog | 4 ++++ gcc/c-family/ChangeLog | 4 ++++ gcc/c-family/c.opt | 6 +++++- gcc/doc/invoke.texi | 10 ++++++---- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/lib/target-supports.exp | 9 ++++++--- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ef5b4d68f7..6283e8087b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2020-02-15 Jason Merrill + + * doc/invoke.texi (C Dialect Options): Add -std=c++20. + 2020-02-15 Jakub Jelinek PR tree-optimization/93744 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e4250724e84..bcab260859f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2020-02-15 Jason Merrill + + * c.opt: Add -std=c++20. + 2020-02-14 Eric Botcazou * c-ada-spec.c: Include bitmap.h. 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/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/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 77c781a40e8..dca5b150c08 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-02-15 Jason Merrill + + * 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. + 2020-02-15 Jakub Jelinek PR tree-optimization/93744 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. -- 2.30.2