llvm.org GIT mirror llvm / 3bff2bd
Merge 64367 from mainline. Fix MingW build: define GTEST_OS_WINDOWS if OS is MingW, but disable exceptions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_25@64521 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 11 years ago
2 changed file(s) with 10 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1717 CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
1818 CPP.Flags += $(NO_MISSING_FIELD_INITIALIZERS) $(NO_VARIADIC_MACROS)
1919
20 ifeq ($(OS),MingW)
21 CPP.Flags += -DGTEST_OS_WINDOWS=1
22 endif
23
2024 include $(LEVEL)/Makefile.common
19921992 if (!HasSameFixtureClass()) return;
19931993
19941994 internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
1995 #ifdef GTEST_OS_WINDOWS
1995 #if defined(GTEST_OS_WINDOWS) && !defined(__MINGW32__)
19961996 // We are on Windows.
19971997 impl->os_stack_trace_getter()->UponLeavingGTest();
19981998 __try {
20242024 AddExceptionThrownFailure(GetExceptionCode(), "TearDown()");
20252025 }
20262026
2027 #else // We are on Linux or Mac - exceptions are disabled.
2027 #else // We are on Linux, Mac or MingW - exceptions are disabled.
20282028 impl->os_stack_trace_getter()->UponLeavingGTest();
20292029 SetUp();
20302030
22262226 const TimeInMillis start = GetTimeInMillis();
22272227
22282228 impl->os_stack_trace_getter()->UponLeavingGTest();
2229 #ifdef GTEST_OS_WINDOWS
2229 #if defined(GTEST_OS_WINDOWS) && !defined(__MINGW32__)
22302230 // We are on Windows.
22312231 Test* test = NULL;
22322232
22392239 "the test fixture's constructor");
22402240 return;
22412241 }
2242 #else // We are on Linux or Mac OS - exceptions are disabled.
2242 #else // We are on Linux, Mac OS or MingW - exceptions are disabled.
22432243
22442244 // TODO(wan): If test->Run() throws, test won't be deleted. This is
22452245 // not a problem now as we don't use exceptions. If we were to
32703270 // We don't protect this under mutex_, as we only support calling it
32713271 // from the main thread.
32723272 int UnitTest::Run() {
3273 #ifdef GTEST_OS_WINDOWS
3273 #if defined(GTEST_OS_WINDOWS) && !defined(__MINGW32__)
32743274
32753275 #if !defined(_WIN32_WCE)
32763276 // SetErrorMode doesn't exist on CE.
32933293 }
32943294
32953295 #else
3296 // We are on Linux or Mac OS. There is no exception of any kind.
3296 // We are on Linux, Mac OS or MingW. There is no exception of any kind.
32973297
32983298 return impl_->RunAllTests();
32993299 #endif // GTEST_OS_WINDOWS