Closed GoogleCodeExporter closed 9 years ago
mingw 3.4.5 does not support __try so I had to disable them to build / run with
mingw
--- gtest\src\gtest.cc-revBASE.svn000.tmp.cc Sun Oct 19 13:50:44 2008
+++ gtest\src\gtest.cc Sun Oct 19 13:38:36 2008
@@ -1967,8 +1967,8 @@
if (!HasSameFixtureClass()) return;
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-#ifdef GTEST_OS_WINDOWS
- // We are on Windows.
+#if defined(GTEST_OS_WINDOWS) && !defined(__MINGW__) && !defined(__MINGW32__)
+ // We are on Windows but mingw does not support __try.
impl->os_stack_trace_getter()->UponLeavingGTest();
__try {
SetUp();
@@ -1999,7 +1999,7 @@
AddExceptionThrownFailure(GetExceptionCode(), "TearDown()");
}
-#else // We are on Linux or Mac - exceptions are disabled.
+#else // We are on Linux or Mac or using mingw - exceptions are disabled.
impl->os_stack_trace_getter()->UponLeavingGTest();
SetUp();
@@ -2170,8 +2170,8 @@
const TimeInMillis start = GetTimeInMillis();
impl->os_stack_trace_getter()->UponLeavingGTest();
-#ifdef GTEST_OS_WINDOWS
- // We are on Windows.
+#if defined(GTEST_OS_WINDOWS) && !defined(__MINGW__) && !defined(__MINGW32__)
+ // We are on Windows but mingw does not support __try.
Test* test = NULL;
__try {
@@ -2183,7 +2183,7 @@
"the test fixture's constructor");
return;
}
-#else // We are on Linux or Mac OS - exceptions are disabled.
+#else // We are on Linux or Mac OS or using 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
@@ -3214,7 +3214,8 @@
// 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(__MINGW__) && !defined(__MINGW32__)
+ // We are on Windows but mingw does not support __try.
#if !defined(_WIN32_WCE)
// SetErrorMode doesn't exist on CE.
@@ -3237,7 +3238,7 @@
}
#else
- // We are on Linux or Mac OS. There is no exception of any kind.
+ // We are on Linux or Mac OS or using mingw. There is no exception of any
kind.
return impl_->RunAllTests();
#endif // GTEST_OS_WINDOWS
Original comment by y.pag...@gmail.com
on 19 Oct 2008 at 10:58
I cannot verify it, but this is likely to be fixed in 1.2.0. Please re-open
the bug
if you still have problem building gtest 1.2.0 on mingw.
Original comment by shiq...@gmail.com
on 2 Dec 2008 at 5:06
Original issue reported on code.google.com by
shiq...@gmail.com
on 30 Sep 2008 at 10:21