summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-07-08 21:44:59 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-07-08 21:44:59 (GMT)
commit5e4214cee4f74d25f1d89dc1c95dc247ed20b6c8 (patch)
tree4191968879b2cf55f8f23b54479ac893336b2247 /src
parent682c89f7557eb53c7359b6cbf3670c05165f2419 (diff)
downloadgoogletest-5e4214cee4f74d25f1d89dc1c95dc247ed20b6c8.zip
googletest-5e4214cee4f74d25f1d89dc1c95dc247ed20b6c8.tar.gz
googletest-5e4214cee4f74d25f1d89dc1c95dc247ed20b6c8.tar.bz2
Makes gtest_break_on_failure_unittest work on minGW (by vladl); improves
the NULL-dereferencing hack to work with LLVM (by chandlerc).
Diffstat (limited to 'src')
-rw-r--r--src/gtest.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gtest.cc b/src/gtest.cc
index cb2c34c..9855f53 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -3608,7 +3608,11 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
// the --gtest_catch_exceptions flags are specified.
DebugBreak();
#else
- *static_cast<int*>(NULL) = 1;
+ // Dereference NULL through a volatile pointer to prevent the compiler
+ // from removing. We use this rather than abort() or __builtin_trap() for
+ // portability: Symbian doesn't implement abort() well, and some debuggers
+ // don't correctly trap abort().
+ *static_cast<volatile int*>(NULL) = 1;
#endif // GTEST_OS_WINDOWS
} else if (GTEST_FLAG(throw_on_failure)) {
#if GTEST_HAS_EXCEPTIONS