[PATCH] clang-cl Add support for two MSVC conversion warnings

Reid Kleckner rnk at google.com
Thu Oct 30 15:05:59 PDT 2014


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.

================
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">;
----------------
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.

================
Comment at: test/Driver/cl-options.c:167-175
@@ -166,5 +166,11 @@
 // For some warning ids, we can map from MSVC warning to Clang warning.
 // RUN: %clang_cl -wd4005 -### -- %s 2>&1 | FileCheck -check-prefix=wd4005 %s
 // wd4005: "-cc1"
 // wd4005: "-Wno-macro-redefined"
+// RUN: %clang_cl -wd4244 -### -- %s 2>&1 | FileCheck -check-prefix=wd4244 %s
+// wd4244: "-cc1"
+// wd4244: "-Wno-float-conversion"
+// RUN: %clang_cl -wd4267 -### -- %s 2>&1 | FileCheck -check-prefix=wd4267 %s
+// wd4267: "-cc1"
+// wd4267: "-Wno-shorten-64-to-32"
 
----------------
I'd combine this to speed up the test a bit.

http://reviews.llvm.org/D6041






More information about the cfe-commits mailing list