aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-10-19 09:34:41 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-11-12 10:06:11 -0800
commit0217faf13f13b9899f480513f248611893d23871 (patch)
tree2af973c088bf8b9c02eac0691eb6be62bc1fa89b /mesonbuild/compilers
parent2844afedde3992564e0de4538b29781a420f8576 (diff)
downloadmeson-0217faf13f13b9899f480513f248611893d23871.zip
meson-0217faf13f13b9899f480513f248611893d23871.tar.gz
meson-0217faf13f13b9899f480513f248611893d23871.tar.bz2
compilers/c: Log that MSVC doesn't support gnu stds
Since the current approach of demoting to the nearest C standard *might* work, but might not. For projects like Glib that detect which standard is used and fall back this is fine. For projects like libdrm that only work with gnu standards, this wont. We're nog tusing a warning because this shouldn't be fatal if --meson-fatal-warnings is used. Also demote a similar message in IntelCl from warning to log.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/c.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 8860906..78185b2 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -420,6 +420,11 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi
def get_option_compile_args(self, options: 'OptionDictType') -> T.List[str]:
args = []
std = options['std']
+ if std.value.startswith('gnu'):
+ mlog.log(
+ 'cl.exe does not actually support gnu standards, and meson '
+ 'will instead demote to the nearest ISO C standard. This '
+ 'may cause compilation to fail.', once=True)
# As of MVSC 16.7, /std:c11 is the only valid C standard option.
if std.value in {'c11', 'gnu11'}:
args.append('/std:c11')
@@ -449,6 +454,13 @@ class ClangClCCompiler(ClangClCompiler, VisualStudioLikeCCompilerMixin, CCompile
'gnu89', 'gnu90', 'gnu9x', 'gnu99']
opts['std'].choices = c_stds # type: ignore
return opts
+ def get_option_compile_args(self, options: 'OptionDictType') -> T.List[str]:
+ if options['std'].value.startswith('gnu'):
+ mlog.warning(
+ 'Clang-cl does not actually support gnu standards, and '
+ 'meson will instead demote to the nearest ISO C standard. This '
+ 'may cause compilation to fail.', once=True)
+ return []
class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerMixin, CCompiler):
@@ -474,7 +486,7 @@ class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerM
args = []
std = options['std']
if std.value == 'c89':
- mlog.warning("ICL doesn't explicitly implement c89, setting the standard to 'none', which is close.", once=True)
+ mlog.log("ICL doesn't explicitly implement c89, setting the standard to 'none', which is close.", once=True)
elif std.value != 'none':
args.append('/Qstd:' + std.value)
return args