From a2d222c383f569241006f826690f599c4f187849 Mon Sep 17 00:00:00 2001 From: jrl64 <32905389+jrl64@users.noreply.github.com> Date: Wed, 10 Apr 2019 15:14:51 -0500 Subject: Update Built-in Option c_std for C17. Closes #4842. --- mesonbuild/compilers/c.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'mesonbuild/compilers') 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({ -- cgit v1.1