diff options
author | jrl64 <32905389+jrl64@users.noreply.github.com> | 2019-04-10 15:14:51 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-04-10 23:14:51 +0300 |
commit | a2d222c383f569241006f826690f599c4f187849 (patch) | |
tree | 4acb984888651b3cdf728a70ee57820a9640e21d /mesonbuild/compilers/c.py | |
parent | 04710b087a3033aa692e1fc3bdbb2dbe2a8ec70e (diff) | |
download | meson-a2d222c383f569241006f826690f599c4f187849.zip meson-a2d222c383f569241006f826690f599c4f187849.tar.gz meson-a2d222c383f569241006f826690f599c4f187849.tar.bz2 |
Update Built-in Option c_std for C17. Closes #4842.
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r-- | mesonbuild/compilers/c.py | 21 |
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({ |