From 450155110c5d2be2cc54dcf9a0f8e2345da19434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 15 Aug 2020 19:45:31 +0200 Subject: [PATCH 1/2] Add C2x option support. --- docs/markdown/Builtin-options.md | 2 +- docs/markdown/Configuring-a-build-directory.md | 2 +- mesonbuild/compilers/c.py | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index de801ab42..7461fa6bc 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -163,7 +163,7 @@ compiler being used: | ------ | ------------- | --------------- | ----------- | | c_args | | free-form comma-separated list | C compile arguments to use | | c_link_args | | free-form comma-separated list | C link arguments to use | -| c_std | none | none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, gnu18 | C language standard to use | +| c_std | none | none, c89, c99, c11, c17, c18, c2x, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x | C language standard to use | | c_winlibs | see below | free-form comma-separated list | Standard Windows libs to link against | | 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 | diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md index 330899f79..6081c35bf 100644 --- a/docs/markdown/Configuring-a-build-directory.md +++ b/docs/markdown/Configuring-a-build-directory.md @@ -60,7 +60,7 @@ sample output for a simple project. ------ ------------- --------------- ----------- c_args [] Extra arguments passed to the C compiler c_link_args [] Extra arguments passed to the C linker - c_std c99 [none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, gnu18] C language standard to use + c_std c99 [none, c89, c99, c11, c17, c18, c2x, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x] C language standard to use 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 diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 95851be1d..d600ac4fa 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -84,6 +84,7 @@ class ClangCCompiler(ClangCompiler, CCompiler): _C17_VERSION = '>=6.0.0' _C18_VERSION = '>=8.0.0' + _C2X_VERSION = '>=9.0.0' def __init__(self, exelist, version, for_machine: MachineChoice, is_cross, info: 'MachineInfo', exe_wrapper=None, @@ -108,6 +109,9 @@ class ClangCCompiler(ClangCompiler, CCompiler): if version_compare(self.version, self._C18_VERSION): c_stds += ['c18'] g_stds += ['gnu18'] + if version_compare(self.version, self._C2X_VERSION): + c_stds += ['c2x'] + g_stds += ['gnu2x'] opts.update({ 'std': coredata.UserComboOption( 'C language standard to use', @@ -147,6 +151,7 @@ class AppleClangCCompiler(ClangCCompiler): _C17_VERSION = '>=10.0.0' _C18_VERSION = '>=11.0.0' + _C2X_VERSION = '>=11.0.0' class EmscriptenCCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCCompiler): @@ -195,6 +200,10 @@ class ArmclangCCompiler(ArmclangCompiler, CCompiler): class GnuCCompiler(GnuCompiler, CCompiler): + + _C18_VERSION = '>=8.0.0' + _C2X_VERSION = '>=9.0.0' + def __init__(self, exelist, version, for_machine: MachineChoice, is_cross, info: 'MachineInfo', exe_wrapper=None, defines=None, **kwargs): @@ -211,10 +220,12 @@ class GnuCCompiler(GnuCompiler, CCompiler): opts = CCompiler.get_options(self) c_stds = ['c89', 'c99', 'c11'] g_stds = ['gnu89', 'gnu99', 'gnu11'] - v = '>=8.0.0' - if version_compare(self.version, v): + if version_compare(self.version, self._C18_VERSION): c_stds += ['c17', 'c18'] g_stds += ['gnu17', 'gnu18'] + if version_compare(self.version, self._C2X_VERSION): + c_stds += ['c2x'] + g_stds += ['gnu2x'] opts.update({ 'std': coredata.UserComboOption( 'C language standard to use', From 9f338e41b06cbdd9a61a1122932177087c49bff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 15 Aug 2020 19:48:52 +0200 Subject: [PATCH 2/2] Update LLVM tool versions for LLVM/Clang 10. --- mesonbuild/environment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index da2d513e6..857120238 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -196,6 +196,7 @@ def get_llvm_tool_names(tool: str) -> T.List[str]: # unless it becomes a stable release. suffixes = [ '', # base (no suffix) + '-10', '100', '-9', '90', '-8', '80', '-7', '70', @@ -207,7 +208,7 @@ def get_llvm_tool_names(tool: str) -> T.List[str]: '-3.7', '37', '-3.6', '36', '-3.5', '35', - '-10', # Debian development snapshot + '-11', # Debian development snapshot '-devel', # FreeBSD development snapshot ] names = []