[llvm] r352322 - Fix some warnings on MSVC

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 27 10:41:40 PST 2019


Author: aganea
Date: Sun Jan 27 10:41:40 2019
New Revision: 352322

URL: http://llvm.org/viewvc/llvm-project?rev=352322&view=rev
Log:
Fix some warnings on MSVC

Differential Revision: https://reviews.llvm.org/D56329

Modified:
    llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt
    llvm/trunk/unittests/Support/CMakeLists.txt

Modified: llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt?rev=352322&r1=352321&r2=352322&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt Sun Jan 27 10:41:40 2019
@@ -11,3 +11,8 @@ if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
     -Wno-unused-private-field
     )
 endif()
+
+if(MSVC)
+  # ignore "warning LNK4199: /DELAYLOAD:shell32.dll ignored; no imports found from shell32.dll"
+  target_link_libraries(Kaleidoscope-Ch2 PRIVATE "-ignore:4199")
+endif()

Modified: llvm/trunk/unittests/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CMakeLists.txt?rev=352322&r1=352321&r2=352322&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Support/CMakeLists.txt Sun Jan 27 10:41:40 2019
@@ -83,7 +83,21 @@ target_link_libraries(SupportTests PRIVA
 # Disable all warning for AlignOfTest.cpp,
 # as it does things intentionally, and there is no reliable way of
 # disabling all warnings for all the compilers by using pragmas.
-set_source_files_properties(AlignOfTest.cpp PROPERTIES COMPILE_FLAGS -w)
+# Don't disable on MSVC, because all incriminated warnings are already disabled
+# in source; and because we would otherwise see this warning:
+#   cl : Command line warning D9025: overriding '/W4' with '/w'
+if(NOT MSVC)
+  set_source_files_properties(AlignOfTest.cpp PROPERTIES COMPILE_FLAGS -w)
+endif()
+if(MSVC)
+  if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.15 )
+    # Since VS2017 15.8, the following snippet: Failed<CustomSubError>()
+    # generates a warning:
+    # \svn\llvm\utils\unittest\googlemock\include\gmock\gmock-matchers.h(186):
+    #   warning C5046: 'testing::MatcherInterface<T>::~MatcherInterface': Symbol involving type with internal linkage not defined
+    set_source_files_properties(ErrorTest.cpp PROPERTIES COMPILE_FLAGS -wd5046)
+  endif()
+endif()
 
 # ManagedStatic.cpp uses <pthread>.
 target_link_libraries(SupportTests PRIVATE LLVMTestingSupport ${LLVM_PTHREAD_LIB})




More information about the llvm-commits mailing list