diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-01-10 18:17:59 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-01-10 18:17:59 +0000 |
commit | 48b1315108cdba8f37394aedb8098102ca00e8b9 (patch) | |
tree | c8d12776d79b243cb2c9dcb307965b6e4582959d /test | |
parent | afaefb0e30366cf8bedb41daf14dc9e17a5d1ff9 (diff) | |
download | googletest-48b1315108cdba8f37394aedb8098102ca00e8b9.tar.gz googletest-48b1315108cdba8f37394aedb8098102ca00e8b9.tar.bz2 googletest-48b1315108cdba8f37394aedb8098102ca00e8b9.zip |
Fixes GCC 4.6 warnings (patch by Jeffrey Yasskin).
Diffstat (limited to 'test')
-rw-r--r-- | test/gtest-port_test.cc | 1 | ||||
-rw-r--r-- | test/gtest_unittest.cc | 18 |
2 files changed, 11 insertions, 8 deletions
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc index bf42d8b8..db63ea98 100644 --- a/test/gtest-port_test.cc +++ b/test/gtest-port_test.cc @@ -168,6 +168,7 @@ class To { TEST(ImplicitCastTest, CanUseImplicitConstructor) { bool converted = false; To to = ::testing::internal::implicit_cast<To>(&converted); + (void)to; EXPECT_TRUE(converted); } diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 89a4a0e7..1069ecf8 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -322,13 +322,11 @@ TEST(NullLiteralTest, IsTrueForNullLiterals) { EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0)); EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U)); EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L)); - EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(false)); #ifndef __BORLANDC__ // Some compilers may fail to detect some null pointer literals; // as long as users of the framework don't use such literals, this // is harmless. EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1)); - EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(true && false)); #endif } @@ -3731,7 +3729,8 @@ TEST(AssertionTest, ASSERT_ANY_THROW) { // compile. TEST(AssertionTest, AssertPrecedence) { ASSERT_EQ(1 < 2, true); - ASSERT_EQ(true && false, false); + bool false_value = false; + ASSERT_EQ(true && false_value, false); } // A subroutine used by the following test. @@ -4220,7 +4219,7 @@ TEST(ExpectTest, EXPECT_EQ_Double) { TEST(ExpectTest, EXPECT_EQ_NULL) { // A success. const char* p = NULL; - // Some older GCC versions may issue a spurious waring in this or the next + // Some older GCC versions may issue a spurious warning in this or the next // assertion statement. This warning should not be suppressed with // static_cast since the test verifies the ability to use bare NULL as the // expected parameter to the macro. @@ -4490,8 +4489,10 @@ TEST(MacroTest, SUCCEED) { // Tests using bool values in {EXPECT|ASSERT}_EQ. TEST(EqAssertionTest, Bool) { EXPECT_EQ(true, true); - EXPECT_FATAL_FAILURE(ASSERT_EQ(false, true), - "Value of: true"); + EXPECT_FATAL_FAILURE({ + bool false_value = false; + ASSERT_EQ(false_value, true); + }, "Value of: true"); } // Tests using int values in {EXPECT|ASSERT}_EQ. @@ -6470,8 +6471,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) { // Verifies that StaticAssertTypeEq works in a namespace scope. -static bool dummy1 = StaticAssertTypeEq<bool, bool>(); -static bool dummy2 = StaticAssertTypeEq<const int, const int>(); +static bool dummy1 GTEST_ATTRIBUTE_UNUSED_ = StaticAssertTypeEq<bool, bool>(); +static bool dummy2 GTEST_ATTRIBUTE_UNUSED_ = + StaticAssertTypeEq<const int, const int>(); // Verifies that StaticAssertTypeEq works in a class. |