From 8434218fff32de45be1fcb9da776cec1d1b27d1f Mon Sep 17 00:00:00 2001 From: ajs Date: Wed, 22 Jan 2025 22:34:31 +0530 Subject: [PATCH 1/2] adding c_std=c2y option for clang Signed-off-by: ajs --- docs/markdown/Builtin-options.md | 2 +- docs/markdown/Configuring-a-build-directory.md | 2 +- mesonbuild/compilers/c.py | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index 3a912805a057..d64cd85c0fab 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -273,7 +273,7 @@ or 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, c2x, c23, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x, gnu23 | C language standard to use | +| c_std | none | none, c89, c99, c11, c17, c18, c2x, c23, c2y, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x, gnu23, gnu2y | 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 db6fc03ef453..746e4b16b6c4 100644 --- a/docs/markdown/Configuring-a-build-directory.md +++ b/docs/markdown/Configuring-a-build-directory.md @@ -61,7 +61,7 @@ a 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, c2x, c23, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x, gnu23] C language standard to use + c_std c99 [none, c89, c99, c11, c17, c18, c2x, c23, c2y, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x, gnu23, gnu2y] 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 c75120fee4d0..51fd724c1bc7 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -47,7 +47,7 @@ else: CompilerMixinBase = object -_ALL_STDS = ['c89', 'c9x', 'c90', 'c99', 'c1x', 'c11', 'c17', 'c18', 'c2x', 'c23'] +_ALL_STDS = ['c89', 'c9x', 'c90', 'c99', 'c1x', 'c11', 'c17', 'c18', 'c2x', 'c23', 'c2y'] _ALL_STDS += [f'gnu{std[1:]}' for std in _ALL_STDS] _ALL_STDS += ['iso9899:1990', 'iso9899:199409', 'iso9899:1999', 'iso9899:2011', 'iso9899:2017', 'iso9899:2018'] @@ -115,6 +115,7 @@ class _ClangCStds(CompilerMixinBase): _C18_VERSION = '>=8.0.0' _C2X_VERSION = '>=9.0.0' _C23_VERSION = '>=18.0.0' + _C2Y_VERSION = '>=19.0.0' def get_options(self) -> 'MutableKeyedOptionDictType': opts = super().get_options() @@ -129,6 +130,8 @@ def get_options(self) -> 'MutableKeyedOptionDictType': stds += ['c2x'] if version_compare(self.version, self._C23_VERSION): stds += ['c23'] + if version_compare(self.version, self._C2Y_VERSION): + stds += ['c2y'] key = self.form_compileropt_key('std') std_opt = opts[key] assert isinstance(std_opt, options.UserStdOption), 'for mypy' From 1c6fa4d4fc32b6f130fdadab0fbb05f97ed1e0de Mon Sep 17 00:00:00 2001 From: ajs Date: Thu, 23 Jan 2025 07:50:27 +0530 Subject: [PATCH 2/2] adding c_std=c2y option for gcc-15 Signed-off-by: ajs --- mesonbuild/compilers/c.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 51fd724c1bc7..0a05b387bcd9 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -277,6 +277,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): _C18_VERSION = '>=8.0.0' _C2X_VERSION = '>=9.0.0' _C23_VERSION = '>=14.0.0' + _C2Y_VERSION = '>=15.0.0' _INVALID_PCH_VERSION = ">=3.4.0" def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, @@ -306,6 +307,8 @@ def get_options(self) -> 'MutableKeyedOptionDictType': stds += ['c2x'] if version_compare(self.version, self._C23_VERSION): stds += ['c23'] + if version_compare(self.version, self._C2Y_VERSION): + stds += ['c2y'] key = self.form_compileropt_key('std') std_opt = opts[key] assert isinstance(std_opt, options.UserStdOption), 'for mypy'