[llvm-commits] [llvm] r64521 - in /llvm/branches/release_25/utils/unittest/googletest: Makefile gtest.cc

Tanya Lattner tonic at nondot.org
Fri Feb 13 17:06:08 PST 2009


Author: tbrethou
Date: Fri Feb 13 19:06:08 2009
New Revision: 64521

URL: http://llvm.org/viewvc/llvm-project?rev=64521&view=rev
Log:
Merge 64367 from mainline.
Fix MingW build: define GTEST_OS_WINDOWS if OS is MingW, but disable
exceptions.

Modified:
    llvm/branches/release_25/utils/unittest/googletest/Makefile
    llvm/branches/release_25/utils/unittest/googletest/gtest.cc

Modified: llvm/branches/release_25/utils/unittest/googletest/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_25/utils/unittest/googletest/Makefile?rev=64521&r1=64520&r2=64521&view=diff

==============================================================================
--- llvm/branches/release_25/utils/unittest/googletest/Makefile (original)
+++ llvm/branches/release_25/utils/unittest/googletest/Makefile Fri Feb 13 19:06:08 2009
@@ -18,4 +18,8 @@
 CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
 CPP.Flags += $(NO_MISSING_FIELD_INITIALIZERS) $(NO_VARIADIC_MACROS)
 
+ifeq ($(OS),MingW)
+  CPP.Flags += -DGTEST_OS_WINDOWS=1
+endif
+
 include $(LEVEL)/Makefile.common

Modified: llvm/branches/release_25/utils/unittest/googletest/gtest.cc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_25/utils/unittest/googletest/gtest.cc?rev=64521&r1=64520&r2=64521&view=diff

==============================================================================
--- llvm/branches/release_25/utils/unittest/googletest/gtest.cc (original)
+++ llvm/branches/release_25/utils/unittest/googletest/gtest.cc Fri Feb 13 19:06:08 2009
@@ -1993,7 +1993,7 @@
   if (!HasSameFixtureClass()) return;
 
   internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-#ifdef GTEST_OS_WINDOWS
+#if defined(GTEST_OS_WINDOWS) && !defined(__MINGW32__)
   // We are on Windows.
   impl->os_stack_trace_getter()->UponLeavingGTest();
   __try {
@@ -2025,7 +2025,7 @@
     AddExceptionThrownFailure(GetExceptionCode(), "TearDown()");
   }
 
-#else  // We are on Linux or Mac - exceptions are disabled.
+#else  // We are on Linux, Mac or MingW - exceptions are disabled.
   impl->os_stack_trace_getter()->UponLeavingGTest();
   SetUp();
 
@@ -2227,7 +2227,7 @@
   const TimeInMillis start = GetTimeInMillis();
 
   impl->os_stack_trace_getter()->UponLeavingGTest();
-#ifdef GTEST_OS_WINDOWS
+#if defined(GTEST_OS_WINDOWS) && !defined(__MINGW32__)
   // We are on Windows.
   Test* test = NULL;
 
@@ -2240,7 +2240,7 @@
                               "the test fixture's constructor");
     return;
   }
-#else  // We are on Linux or Mac OS - exceptions are disabled.
+#else  // We are on Linux, Mac OS or MingW - exceptions are disabled.
 
   // TODO(wan): If test->Run() throws, test won't be deleted.  This is
   // not a problem now as we don't use exceptions.  If we were to
@@ -3271,7 +3271,7 @@
 // We don't protect this under mutex_, as we only support calling it
 // from the main thread.
 int UnitTest::Run() {
-#ifdef GTEST_OS_WINDOWS
+#if defined(GTEST_OS_WINDOWS) && !defined(__MINGW32__)
 
 #if !defined(_WIN32_WCE)
   // SetErrorMode doesn't exist on CE.
@@ -3294,7 +3294,7 @@
   }
 
 #else
-  // We are on Linux or Mac OS.  There is no exception of any kind.
+  // We are on Linux, Mac OS or MingW.  There is no exception of any kind.
 
   return impl_->RunAllTests();
 #endif  // GTEST_OS_WINDOWS





More information about the llvm-commits mailing list