From a7aba905a0e53ebdbaeccb3890291e5c147bd845 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 9 Dec 2020 17:12:16 +0100 Subject: [PATCH] compilers: add support for c++20/gnu++20 Fixes #8084. --- docs/markdown/Builtin-options.md | 2 +- docs/markdown/Configuring-a-build-directory.md | 2 +- mesonbuild/compilers/cpp.py | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index b2e1c3c88..8fe9fbe21 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -172,7 +172,7 @@ compiler being used: | c_thread_count | 4 | integer value ≥ 0 | Number of threads to use with emcc when using threads | | cpp_args | | free-form comma-separated list | C++ compile arguments to use | | cpp_link_args | | free-form comma-separated list | C++ link arguments to use | -| cpp_std | none | none, c++98, c++03, c++11, c++14, c++17, c++2a
c++1z, gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, gnu++2a,
vc++14, vc++17, vc++latest | C++ language standard to use | +| cpp_std | none | none, c++98, c++03, c++11, c++14, c++17, c++20
c++2a, c++1z, gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z,
gnu++2a, gnu++20, vc++14, vc++17, vc++latest | C++ language standard to use | | cpp_debugstl | false | true, false | C++ STL debug mode | | cpp_eh | default | none, default, a, s, sc | C++ exception handling type | | cpp_rtti | true | true, false | Whether to enable RTTI (runtime type identification) | diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md index 6081c35bf..199d1d74e 100644 --- a/docs/markdown/Configuring-a-build-directory.md +++ b/docs/markdown/Configuring-a-build-directory.md @@ -64,7 +64,7 @@ sample output for a simple project. cpp_args [] Extra arguments passed to the C++ compiler cpp_debugstl false [true, false] STL debug mode cpp_link_args [] Extra arguments passed to the C++ linker - cpp_std c++11 [none, c++98, c++03, c++11, c++14, c++17, c++1z, c++2a, gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, gnu++2a] C++ language standard to use + cpp_std c++11 [none, c++98, c++03, c++11, c++14, c++17, c++1z, c++2a, c++20, gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, gnu++2a, gnu++20] C++ language standard to use fortran_std [] [none, legacy, f95, f2003, f2008, f2018] language standard to use Directories: diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 6ba87eb2d..607bea7ff 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -150,7 +150,9 @@ class CPPCompiler(CLikeCompiler, Compiler): 'c++14': 'c++1y', 'gnu++14': 'gnu++1y', 'c++17': 'c++1z', - 'gnu++17': 'gnu++1z' + 'gnu++17': 'gnu++1z', + 'c++20': 'c++2a', + 'gnu++20': 'gnu++2a', } # Currently, remapping is only supported for Clang, Elbrus and GCC @@ -206,7 +208,8 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): }) opts['std'].choices = [ # type: ignore 'none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', - 'c++2a', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a', + 'c++2a', 'c++20', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', + 'gnu++2a', 'gnu++20', ] if self.info.is_windows() or self.info.is_cygwin(): opts.update({ @@ -344,8 +347,8 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): }) opts['std'].choices = [ # type: ignore 'none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', - 'c++2a', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', - 'gnu++2a', + 'c++2a', 'c++20', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', + 'gnu++1z', 'gnu++2a', 'gnu++20', ] if self.info.is_windows() or self.info.is_cygwin(): opts.update({