aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2009-02-14 01:06:08 +0000
committerTanya Lattner <tonic@nondot.org>2009-02-14 01:06:08 +0000
commit3bff2bd4d8c990ce5546f4cd072fa846c559d549 (patch)
tree20cdf44929415f56a54b98eca8d4b22ba6ede233
parent3400fc0434bc7651d205f83bc8d71b943f1059b5 (diff)
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
-rw-r--r--utils/unittest/googletest/Makefile4
-rw-r--r--utils/unittest/googletest/gtest.cc12
2 files changed, 10 insertions, 6 deletions
diff --git a/utils/unittest/googletest/Makefile b/utils/unittest/googletest/Makefile
index 801506ee16..6e262413cc 100644
--- a/utils/unittest/googletest/Makefile
+++ b/utils/unittest/googletest/Makefile
@@ -18,4 +18,8 @@ BUILD_ARCHIVE = 1
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
diff --git a/utils/unittest/googletest/gtest.cc b/utils/unittest/googletest/gtest.cc
index 64dbb84189..e46e90a2c4 100644
--- a/utils/unittest/googletest/gtest.cc
+++ b/utils/unittest/googletest/gtest.cc
@@ -1993,7 +1993,7 @@ void Test::Run() {
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 @@ void Test::Run() {
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 @@ void TestInfoImpl::Run() {
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 @@ void TestInfoImpl::Run() {
"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 @@ void UnitTest::RecordPropertyForCurrentTest(const char* key,
// 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 @@ int UnitTest::Run() {
}
#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