From 8b085f0d2168e6e54712d295dcf26feac92bb9fc Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Wed, 11 Nov 2015 12:28:15 -0500 Subject: Fix warnings encountered in MSVC build of gtest/gmock tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes these warnings: …\gtest\googletest\test\gtest-port_test.cc(78) : error C2220: warning treated as error - no 'object' file generated …\gtest\googletest\test\gtest-port_test.cc(78) : warning C4309: 'static_cast' : truncation of constant value …\gtest\googletest\test\gtest-port_test.cc(79) : warning C4309: 'static_cast' : truncation of constant value …\gtest\googlemock\test\gmock-matchers_test.cc(2712) : error C2220: warning treated as error - no 'object' file generated …\gtest\googlemock\test\gmock-matchers_test.cc(2706) : while compiling class template member function 'testing::gmock_matchers_test::FloatingPointTest::FloatingPointTest(void)' …\gtest\googlemock\test\gmock-matchers_test.cc(2896) : see reference to function template instantiation 'testing::gmock_matchers_test::FloatingPointTest::FloatingPointTest(void)' being compiled …\gtest\googlemock\test\gmock-matchers_test.cc(2896) : see reference to class template instantiation 'testing::gmock_matchers_test::FloatingPointTest' being compiled …\gtest\googlemock\test\gmock-matchers_test.cc(2712) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data …\gtest\googlemock\test\gmock-matchers_test.cc(2714) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data …\gtest\googlemock\test\gmock-matchers_test.cc(2716) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data …\gtest\googlemock\test\gmock-matchers_test.cc(2717) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data …\gtest\googlemock\test\gmock-matchers_test.cc(2718) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data …\gtest\googlemock\test\gmock-matchers_test.cc(2721) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data …\gtest\googlemock\test\gmock-matchers_test.cc(2723) : warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data --- googlemock/test/gmock-matchers_test.cc | 2 +- googletest/test/gtest-port_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 7282469..8cc37e7 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -2778,7 +2778,7 @@ class FloatingPointTest : public testing::Test { // Pre-calculated numbers to be used by the tests. - const size_t max_ulps_; + const unsigned int max_ulps_; const Bits zero_bits_; // The bits that represent 0.0. const Bits one_bits_; // The bits that represent 1.0. diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index d17bad0..446660f 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -75,8 +75,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) { } TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { - EXPECT_FALSE(IsXDigit(static_cast(0x80))); - EXPECT_FALSE(IsXDigit(static_cast('0' | 0x80))); + EXPECT_FALSE(IsXDigit(static_cast(0x80u))); + EXPECT_FALSE(IsXDigit(static_cast('0' | 0x80u))); } TEST(IsXDigitTest, WorksForWideAscii) { -- cgit v0.12