diff options
author | Alex Rønne Petersen <alex@alexrp.com> | 2020-08-15 19:45:31 +0200 |
---|---|---|
committer | Alex Rønne Petersen <alex@alexrp.com> | 2020-08-22 18:57:05 +0200 |
commit | 450155110c5d2be2cc54dcf9a0f8e2345da19434 (patch) | |
tree | cceb6795957c932cb926cd65e83b22f0991e38b5 /mesonbuild/compilers/c.py | |
parent | 7092efabb5a0488b694418c823463048ddbb310c (diff) | |
download | meson-450155110c5d2be2cc54dcf9a0f8e2345da19434.zip meson-450155110c5d2be2cc54dcf9a0f8e2345da19434.tar.gz meson-450155110c5d2be2cc54dcf9a0f8e2345da19434.tar.bz2 |
Add C2x option support.
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r-- | mesonbuild/compilers/c.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 95851be..d600ac4 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', |