summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-01-09 14:11:39 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2024-01-15 23:31:52 +0200
commit0bfe98e7e62b62b96448c48e9d06409bbfdf8bc0 (patch)
tree27a7f3af35eacec64597f6dc06e23e1976370580 /mesonbuild
parent1c852f0a985f2daa42ca209008eebcd7a42fb58e (diff)
downloadmeson-0bfe98e7e62b62b96448c48e9d06409bbfdf8bc0.tar.gz
compilers: add c23 and gnu23 c_stds
Closes: https://github.com/mesonbuild/meson/issues/12702
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/c.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 951ec8e38..a943552e1 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -46,7 +46,7 @@ if T.TYPE_CHECKING:
else:
CompilerMixinBase = object
-_ALL_STDS = ['c89', 'c9x', 'c90', 'c99', 'c1x', 'c11', 'c17', 'c18', 'c2x']
+_ALL_STDS = ['c89', 'c9x', 'c90', 'c99', 'c1x', 'c11', 'c17', 'c18', 'c2x', 'c23']
_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']
@@ -113,6 +113,7 @@ class _ClangCStds(CompilerMixinBase):
_C17_VERSION = '>=6.0.0'
_C18_VERSION = '>=8.0.0'
_C2X_VERSION = '>=9.0.0'
+ _C23_VERSION = '>=18.0.0'
def get_options(self) -> 'MutableKeyedOptionDictType':
opts = super().get_options()
@@ -125,6 +126,8 @@ class _ClangCStds(CompilerMixinBase):
stds += ['c18']
if version_compare(self.version, self._C2X_VERSION):
stds += ['c2x']
+ if version_compare(self.version, self._C23_VERSION):
+ stds += ['c23']
std_opt = opts[OptionKey('std', machine=self.for_machine, lang=self.language)]
assert isinstance(std_opt, coredata.UserStdOption), 'for mypy'
std_opt.set_versions(stds, gnu=True)
@@ -253,6 +256,7 @@ class GnuCCompiler(GnuCompiler, CCompiler):
_C18_VERSION = '>=8.0.0'
_C2X_VERSION = '>=9.0.0'
+ _C23_VERSION = '>=14.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,
@@ -280,6 +284,8 @@ class GnuCCompiler(GnuCompiler, CCompiler):
stds += ['c17', 'c18']
if version_compare(self.version, self._C2X_VERSION):
stds += ['c2x']
+ if version_compare(self.version, self._C23_VERSION):
+ stds += ['c23']
key = OptionKey('std', machine=self.for_machine, lang=self.language)
std_opt = opts[key]
assert isinstance(std_opt, coredata.UserStdOption), 'for mypy'