aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-10-19 09:28:46 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-11-12 10:03:14 -0800
commit3e62307f3a5d184c8c331de2809d5eaa38f001fd (patch)
tree5d6f6bc1466e7a6e7f6d8e5b77adfc77672b942e /mesonbuild/compilers/c.py
parent333e0aeef4b2cc7be82a89c3a1a5a4a4b9af2b53 (diff)
downloadmeson-3e62307f3a5d184c8c331de2809d5eaa38f001fd.zip
meson-3e62307f3a5d184c8c331de2809d5eaa38f001fd.tar.gz
meson-3e62307f3a5d184c8c331de2809d5eaa38f001fd.tar.bz2
compilers/c: Clang-cl also needs specific handling for standards
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 8d0a52b..fd3ebc0 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -462,6 +462,25 @@ class ClangClCCompiler(ClangClCompiler, VisualStudioLikeCCompilerMixin, CCompile
full_version=full_version)
ClangClCompiler.__init__(self, target)
+ def get_options(self) -> 'OptionDictType':
+ # Clang-cl can compile up to c99, but doesn't have a std-swtich for
+ # them. Unlike recent versions of MSVC it doesn't (as of 10.0.1)
+ # support c11
+ opts = super().get_options()
+ c_stds = ['none', 'c89', 'c99',
+ # Need to have these to be compatible with projects
+ # that set c_std to e.g. gnu99.
+ # https://github.com/mesonbuild/meson/issues/7611
+ 'gnu89', 'gnu90', 'gnu9x', 'gnu99']
+ opts.update({
+ 'std': coredata.UserComboOption(
+ 'C language standard to use',
+ c_stds,
+ 'none',
+ ),
+ })
+ return opts
+
class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerMixin, CCompiler):