aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-03-08 20:42:47 +0000
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-03-08 20:42:47 +0000
commit40604f891efd16779af66c2b3e42f433ead74b15 (patch)
tree4c7a4fe51282b47d3724611d346bad100db39f6a
parent79e11d7c7d17e6f893467656815a79d8e84dd7c3 (diff)
downloadgoogletest-40604f891efd16779af66c2b3e42f433ead74b15.tar.gz
googletest-40604f891efd16779af66c2b3e42f433ead74b15.tar.bz2
googletest-40604f891efd16779af66c2b3e42f433ead74b15.zip
Fixes an 'unreachable code' warning by MSVC on certain opt settings in gtest-death-test_test.cc.
-rw-r--r--test/gtest-death-test_test.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc
index c57d700f..ed5b53b7 100644
--- a/test/gtest-death-test_test.cc
+++ b/test/gtest-death-test_test.cc
@@ -110,7 +110,12 @@ void DieInside(const char* function) {
// system call and thus safer in the presence of threads. exit()
// will invoke user-defined exit-hooks, which may do dangerous
// things that conflict with death tests.
- _exit(1);
+ //
+ // Some compilers can recognize that _exit() never returns and issue the
+ // 'unreachable code' warning for code following this function, unless
+ // fooled by a fake condition.
+ if (AlwaysTrue())
+ _exit(1);
}
// Tests that death tests work.