Teach VisualStudioCCompiler.has_arguments() about clang-cl

When invoked as clang-cl to compile, it doesn't emit cl-compatible D9002
warnings about unknown options, but fortunately also supports
-Werror-unknown-argument instead.

When invoked to link, and using LINK, it does emit cl-compatible LNK4044
warnings about unknown options.
pull/4250/head
Jon Turney 6 years ago
parent bb31a8c1c7
commit b5b7e5b94a
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 2
      mesonbuild/compilers/c.py

@ -1451,6 +1451,8 @@ class VisualStudioCCompiler(CCompiler):
# http://stackoverflow.com/questions/15259720/how-can-i-make-the-microsoft-c-compiler-treat-unknown-flags-as-errors-rather-t
def has_arguments(self, args, env, code, mode):
warning_text = '4044' if mode == 'link' else '9002'
if self.id == 'clang-cl' and mode != 'link':
args = args + ['-Werror=unknown-argument']
with self._build_wrapper(code, env, extra_args=args, mode=mode) as p:
if p.returncode != 0:
return False

Loading…
Cancel
Save