[PATCH] D56329: Fix some warnings on MSVC
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 4 12:54:42 PST 2019
aganea created this revision.
aganea added reviewers: gkistanova, rnk.
Herald added a subscriber: mgorny.
Fixes the following warnings on (latest) MSVC:
1. In Kaleidoscope-Ch2: `"warning LNK4199: /DELAYLOAD:shell32.dll ignored; no imports found from shell32.dll"`
2. In gtest (see this link <https://developercommunity.visualstudio.com/content/problem/288509/undocumented-warning-c5046-symbol-involving-type-w.html>):
f:\svn\llvm\utils\unittest\googlemock\include\gmock\gmock-matchers.h(183): warning C5046: 'testing::MatcherInterface<T>::~MatcherInterface': Symbol involving type with internal linkage not defined
23> with
23> [
23> T=`anonymous-namespace'::CustomSubError &
23> ] (compiling source file F:\svn\llvm\unittests\Support\ErrorTest.cpp)
3. In SupportTests: `cl : Command line warning D9025: overriding '/W4' with '/w'`
Repository:
rL LLVM
https://reviews.llvm.org/D56329
Files:
examples/Kaleidoscope/Chapter2/CMakeLists.txt
unittests/Support/CMakeLists.txt
utils/unittest/googlemock/include/gmock/gmock-matchers.h
Index: utils/unittest/googlemock/include/gmock/gmock-matchers.h
===================================================================
--- utils/unittest/googlemock/include/gmock/gmock-matchers.h
+++ utils/unittest/googlemock/include/gmock/gmock-matchers.h
@@ -142,6 +142,11 @@
template <typename T>
class MatcherInterface : public MatcherDescriberInterface {
public:
+ // Define virtual destructor to avoid the following MSVC warning:
+ // warning C5046: 'testing::MatcherInterface<T>::~MatcherInterface':
+ // Symbol involving type with internal linkage not defined
+ virtual ~MatcherInterface() {}
+
// Returns true iff the matcher matches x; also explains the match
// result to 'listener' if necessary (see the next paragraph), in
// the form of a non-restrictive relative clause ("which ...",
Index: unittests/Support/CMakeLists.txt
===================================================================
--- unittests/Support/CMakeLists.txt
+++ unittests/Support/CMakeLists.txt
@@ -83,7 +83,12 @@
# 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()
# ManagedStatic.cpp uses <pthread>.
target_link_libraries(SupportTests PRIVATE LLVMTestingSupport ${LLVM_PTHREAD_LIB})
Index: examples/Kaleidoscope/Chapter2/CMakeLists.txt
===================================================================
--- examples/Kaleidoscope/Chapter2/CMakeLists.txt
+++ examples/Kaleidoscope/Chapter2/CMakeLists.txt
@@ -11,3 +11,8 @@
-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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56329.180302.patch
Type: text/x-patch
Size: 2170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190104/582682c4/attachment.bin>
More information about the llvm-commits
mailing list