aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 0a6e3b3..12f7838 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -1220,9 +1220,17 @@ class ClangCCompiler(ClangCompiler, CCompiler):
def get_options(self):
opts = CCompiler.get_options(self)
+ c_stds = ['c89', 'c99', 'c11']
+ g_stds = ['gnu89', 'gnu99', 'gnu11']
+ if self.compiler_type is CompilerType.CLANG_OSX:
+ v = '>=10.0.0'
+ else:
+ v = '>=7.0.0'
+ if version_compare(self.version, v):
+ c_stds += ['c17']
+ g_stds += ['gnu17']
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
- ['none', 'c89', 'c99', 'c11',
- 'gnu89', 'gnu99', 'gnu11'],
+ ['none'] + c_stds + g_stds,
'none')})
return opts
@@ -1284,9 +1292,14 @@ class GnuCCompiler(GnuCompiler, CCompiler):
def get_options(self):
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):
+ c_stds += ['c17', 'c18']
+ g_stds += ['gnu17', 'gnu18']
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
- ['none', 'c89', 'c99', 'c11',
- 'gnu89', 'gnu99', 'gnu11'],
+ ['none'] + c_stds + g_stds,
'none')})
if self.compiler_type.is_windows_compiler:
opts.update({