From 677e2f3d546d8e7f140d97cd8291a81a423e6451 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 6 May 2020 18:56:38 +0300 Subject: [PATCH] Add cxxstd value 20 for C++20 (#592) * Added cxxstd value 20 for C++20. The -std=c++20 is supported by clang 10. * Updated cxxstd=latest for clang 5.0 and newer. clang 5.0 supports -std=c++17. clang 6.0 supports -std=c++2a. clang 10.0 supports -std=c++20. * Updated cxxstd=latest for gcc. gcc 4.9 supports -std=c++14. gcc 6 supports -std=c++17. gcc 10 will support -std=c++20. * Added support for cxxstd=20 to toolsets that don't support C++20. --- src/tools/clang.jam | 5 ++++- src/tools/cray.jam | 2 +- src/tools/features/cxxstd-feature.jam | 4 ++-- src/tools/gcc.jam | 5 ++++- src/tools/pgi.jam | 1 + src/tools/xlcpp.jam | 4 ++++ 7 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/clang.jam b/tools/clang.jam index bcb3837039..f1850db194 100644 --- a/tools/clang.jam +++ b/tools/clang.jam @@ -55,7 +55,10 @@ rule init-cxxstd-flags ( toolset : condition * : version ) local dialects = [ feature.values ] ; dialects = [ set.difference $(dialects) : gnu iso ] ; local std ; - if [ version-ge $(version) : 3.5 ] { std = 1z ; } + if [ version-ge $(version) : 10.0 ] { std = 20 ; } + else if [ version-ge $(version) : 6.0 ] { std = 2a ; } + else if [ version-ge $(version) : 5.0 ] { std = 17 ; } + else if [ version-ge $(version) : 3.5 ] { std = 1z ; } else if [ version-ge $(version) : 3.4 ] { std = 14 ; } else if [ version-ge $(version) : 3.3 ] { std = 11 ; } else { std = 03 ; } diff --git a/tools/cray.jam b/tools/cray.jam index 107b3dbbc5..d586af3af4 100644 --- a/tools/cray.jam +++ b/tools/cray.jam @@ -707,7 +707,7 @@ rule set-cxxstd-procedure ( targets * : sources * : properties * ) local cxxstd = [ feature.get-values cxxstd : $(properties) ] ; local cray-cxxstd = ; - local unsupported-values = 2a ; # I don't know what '2a' means. + local unsupported-values = 2a 20 ; # I don't know what '2a' means. if $(cxxstd) && $(cxxstd) in $(unsupported-values) { diff --git a/tools/features/cxxstd-feature.jam b/tools/features/cxxstd-feature.jam index dfddf5bb78..3d7ba8d8cc 100644 --- a/tools/features/cxxstd-feature.jam +++ b/tools/features/cxxstd-feature.jam @@ -8,7 +8,7 @@ import feature ; #| tag::doc[] [[bbv2.builtin.features.cxxstd]]`cxxstd`:: -*Allowed values*: `98`, `03`, `0x`, `11`, `1y`, `14`, `1z`, `17`, `2a`, +*Allowed values*: `98`, `03`, `0x`, `11`, `1y`, `14`, `1z`, `17`, `2a`, `20`, `latest`. + Specifies the version of the C++ Standard Language to build with. All the @@ -28,7 +28,7 @@ is supported. |# # end::doc[] feature.feature cxxstd - : 98 03 0x 11 1y 14 1z 17 2a latest + : 98 03 0x 11 1y 14 1z 17 2a 20 latest : optional composite propagated ; #| tag::doc[] diff --git a/tools/gcc.jam b/tools/gcc.jam index 5ceb038fc5..f03336a5d7 100644 --- a/tools/gcc.jam +++ b/tools/gcc.jam @@ -499,8 +499,11 @@ local rule compile-link-flags ( * ) local rule init-cxxstd-flags ( condition * : version ) { local std ; - if [ version-ge $(version) : 8 ] { std = 2a ; } + if [ version-ge $(version) : 10 ] { std = 20 ; } + else if [ version-ge $(version) : 8 ] { std = 2a ; } + else if [ version-ge $(version) : 6 ] { std = 17 ; } else if [ version-ge $(version) : 5 ] { std = 1z ; } + else if [ version-ge $(version) : 4.9 ] { std = 14 ; } else if [ version-ge $(version) : 4.8 ] { std = 1y ; } else if [ version-ge $(version) : 4.7 ] { std = 11 ; } else if [ version-ge $(version) : 3.3 ] { std = 98 ; } diff --git a/tools/pgi.jam b/tools/pgi.jam index b59db4d4ec..6eed7759fb 100644 --- a/tools/pgi.jam +++ b/tools/pgi.jam @@ -57,6 +57,7 @@ flags pgi.compile.c++ OPTIONS 14 : -std=c++14 ; flags pgi.compile.c++ OPTIONS 1z : -std=c++17 ; flags pgi.compile.c++ OPTIONS 17 : -std=c++17 ; flags pgi.compile.c++ OPTIONS 2a : -std=c++17 ; +flags pgi.compile.c++ OPTIONS 20 : -std=c++17 ; flags pgi.compile.c++ OPTIONS latest : -std=c++17 ; flags pgi.compile OPTIONS shared : -fpic ; diff --git a/tools/xlcpp.jam b/tools/xlcpp.jam index 1b66301cf1..a9e767cefb 100644 --- a/tools/xlcpp.jam +++ b/tools/xlcpp.jam @@ -112,6 +112,10 @@ flags xlcpp.compile.c++ OPTIONS 0x : -std=c++11 ; flags xlcpp.compile.c++ OPTIONS 11 : -std=c++11 ; flags xlcpp.compile.c++ OPTIONS 1y : -std=c++1y ; flags xlcpp.compile.c++ OPTIONS 14 : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 1z : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 17 : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 2a : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 20 : -std=c++1y ; flags xlcpp.compile.c++ OPTIONS latest : -std=c++1y ; flags xlcpp.compile OPTIONS ;