[PATCH] clang-cl Add support for two MSVC conversion warnings
Ehsan Akhgari
ehsan.akhgari at gmail.com
Thu Oct 30 15:18:19 PDT 2014
>>! In D6041#4, @rnk wrote:
> It doesn't look like there's a really clean mapping for these warnings from MSVC to clang. I don't want to have overly broad mappings from cl warnings to clang warnings because hopefully clang's on-by-default warnings have lower false positive rates.
>
> If you're actually investigating cleaning up clang warnings, I recommend using the gcc style -W / -Wno flags that we expose through clang-cl. These are much finer grained.
These are two MSVC warnings that we disable for Firefox. That's why I'm implementing them in clang-cl.
================
Comment at: include/clang/Driver/CLCompatOptions.td:131
@@ +130,3 @@
+def _SLASH_wd4244 : CLFlag<"wd4244">, Alias<W_Joined>,
+ AliasArgs<["no-float-conversion"]>,
+ HelpText<"Disable narrowing conversion warnings">;
----------------
rnk wrote:
> Doesn't this also cover integer conversion? The MSDN article makes it appear that way:
> http://msdn.microsoft.com/en-us/library/th7a07tz.aspx
>
> We could make this -Wno-conversion, but that's a pretty big hammer.
Originally I mapped this to Wno-int-conversion too, but it seems like the support for passing more than one string to ArgList is broken (in that I was getting `-Wno-float-conversion no-int-conversion` passed to cc1). After applying this local LLVM patch, things worked correctly, but I'm not sure if this patch is correct or not (it doesn't break any tests, it seems.)
```
diff --git a/lib/Option/Arg.cpp b/lib/Option/Arg.cpp
index 4c8da58..c6120d8 100644
--- a/lib/Option/Arg.cpp
+++ b/lib/Option/Arg.cpp
@@ -107,10 +107,9 @@ void Arg::render(const ArgList &Args, ArgStringList &Output) const {
}
case Option::RenderJoinedStyle:
- Output.push_back(Args.GetOrMakeJoinedArgString(
- getIndex(), getSpelling(), getValue(0)));
for (unsigned i = 1, e = getNumValues(); i != e; ++i)
- Output.push_back(getValue(i));
+ Output.push_back(Args.GetOrMakeJoinedArgString(
+ getIndex(), getSpelling(), getValue(i)));
break;
case Option::RenderSeparateStyle:
```
http://reviews.llvm.org/D6041
More information about the cfe-commits
mailing list