[PATCH] D15731: win: Pass /W4 in front of all the -wd flags.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 17:46:43 PST 2015

thakis created this revision.
thakis added a reviewer: rnk.
thakis added a subscriber: llvm-commits.

This should fix many many -Wunused-parameter warnings in self-host builds on Windows after r255382.



Index: cmake/modules/HandleLLVMOptions.cmake
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -153,6 +153,12 @@
+function(prepend value)
+  foreach(variable ${ARGN})
+    set(${variable} "${value} ${${variable}}" PARENT_SCOPE)
+  endforeach(variable)
 macro(add_flag_if_supported flag name)
   check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}")
   append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS)
@@ -338,7 +344,10 @@
   # Enable warnings
-    append("/W4" msvc_warning_flags)
+    # Put /W4 in front of all the -we flags. cl.exe doesn't care, but for
+    # clang-cl having /W4 after the -we flags will re-enable the warnings
+    # disabled by -we.
+    prepend("/W4" msvc_warning_flags)
     # CMake appends /W3 by default, and having /W3 followed by /W4 will result in 
     # cl : Command line warning D9025 : overriding '/W3' with '/W4'.  Since this is
     # a command line warning and not a compiler warning, it cannot be suppressed except

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15731.43495.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151223/1496fe6c/attachment.bin>

More information about the llvm-commits mailing list