[PATCH] Disable specific MSVC warnings so that W4 warnings can be enabled.

Andy Kaylor andrew.kaylor at intel.com
Mon Mar 23 17:59:20 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: cmake/modules/HandleLLVMOptions.cmake:290
@@ -277,1 +289,3 @@
+    -wd4389 # Suppress 'signed/unsigned mismatch'
+	-wd4611 # Suppress 'interaction between '_setjmp' and C++ object destruction is non-portable'
     
----------------
I'm not sure what happened to the spacing here.  I'll fix it before committing.

================
Comment at: lib/Support/APFloat.cpp:1433
@@ -1432,3 +1432,3 @@
      an addition or subtraction.  */
-  subtract ^= sign ^ rhs.sign;
+  subtract ^= (sign ^ rhs.sign) != 0;
 
----------------
This addresses warning C4805: unsafe mix of type <X> and type <Y> in operation.

================
Comment at: lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp:641
@@ -640,3 +640,3 @@
   unsigned Op = ARM_AM::getAM5Op(MO2.getImm());
-  if (AlwaysPrintImm0 || ImmOffs || Op == ARM_AM::sub) {
+  if (ImmOffs || Op == ARM_AM::sub || AlwaysPrintImm0) {
     O << ", "
----------------
This addresses warning C4189: local variable is initialized but not referenced.

AlwaysPrintImm0 is a template parameter that can short circuit the condition so that ImmOffs and Op are never referenced.

================
Comment at: lib/Target/NVPTX/NVPTXAsmPrinter.cpp:507
@@ -506,4 +506,3 @@
   unsigned RegNo = MI->getOperand(0).getReg();
-  const TargetRegisterInfo *TRI = nvptxSubtarget->getRegisterInfo();
-  if (TRI->isVirtualRegister(RegNo)) {
+  if (TargetRegisterInfo::isVirtualRegister(RegNo)) {
     OutStreamer.AddComment(Twine("implicit-def: ") +
----------------
This addresses warning C4189: local variable is initialized but not referenced.

Because isVirtualRegister() is a static function, the TRI variable was not actually referenced.

================
Comment at: lib/Target/PowerPC/PPCInstrInfo.cpp:117
@@ -117,3 +116,3 @@
   bool IsRegCR;
-  if (TRI->isVirtualRegister(Reg)) {
+  if (TargetRegisterInfo::isVirtualRegister(Reg)) {
     const MachineRegisterInfo *MRI =
----------------
This addresses warning C4189: local variable is initialized but not referenced.

Because isVirtualRegister() is a static function, the TRI variable was not actually referenced.

================
Comment at: tools/llvm-c-test/metadata.c:21
@@ -21,1 +20,3 @@
+  LLVMValueRef values[1];
+  values[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
 
----------------
This addresses warning C4204: nonstandard extension used : non-constant aggregate initializer.

================
Comment at: tools/llvm-c-test/metadata.c:34
@@ -33,1 +33,3 @@
+  LLVMValueRef values[1];
+  values[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
 
----------------
This addresses warning C4204: nonstandard extension used : non-constant aggregate initializer.

http://reviews.llvm.org/D8572

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list