Fixes unused function warning on Mac, and fixes compatibility with newer GCC.

This commit is contained in:
zhanyong.wan 2013-02-28 23:52:42 +00:00
parent 6a036a5c8c
commit fc01f532a6
3 changed files with 6 additions and 6 deletions

View File

@ -813,8 +813,8 @@ struct CompileAssert {
}; };
#define GTEST_COMPILE_ASSERT_(expr, msg) \ #define GTEST_COMPILE_ASSERT_(expr, msg) \
typedef ::testing::internal::CompileAssert<(bool(expr))> \ typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
msg[bool(expr) ? 1 : -1] msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
// Implementation details of GTEST_COMPILE_ASSERT_: // Implementation details of GTEST_COMPILE_ASSERT_:
// //

View File

@ -3571,13 +3571,13 @@ Environment* UnitTest::AddEnvironment(Environment* env) {
// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call // assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
// this to report their results. The user code should use the // this to report their results. The user code should use the
// assertion macros instead of calling this directly. // assertion macros instead of calling this directly.
GTEST_LOCK_EXCLUDED_(mutex_)
void UnitTest::AddTestPartResult( void UnitTest::AddTestPartResult(
TestPartResult::Type result_type, TestPartResult::Type result_type,
const char* file_name, const char* file_name,
int line_number, int line_number,
const std::string& message, const std::string& message,
const std::string& os_stack_trace) const std::string& os_stack_trace) {
GTEST_LOCK_EXCLUDED_(mutex_) {
Message msg; Message msg;
msg << message; msg << message;

View File

@ -465,6 +465,8 @@ TEST_F(TestForDeathTest, MixedStyles) {
EXPECT_DEATH(_exit(1), ""); EXPECT_DEATH(_exit(1), "");
} }
# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
namespace { namespace {
bool pthread_flag; bool pthread_flag;
@ -475,8 +477,6 @@ void SetPthreadFlag() {
} // namespace } // namespace
# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) { TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
if (!testing::GTEST_FLAG(death_test_use_fork)) { if (!testing::GTEST_FLAG(death_test_use_fork)) {
testing::GTEST_FLAG(death_test_style) = "threadsafe"; testing::GTEST_FLAG(death_test_style) = "threadsafe";