Fixes GCC 4.6 warnings (patch by Jeffrey Yasskin).

This commit is contained in:
zhanyong.wan
2011-01-10 18:17:59 +00:00
parent afaefb0e30
commit 48b1315108
5 changed files with 49 additions and 25 deletions

View File

@@ -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.