diff options
Diffstat (limited to 'absl/hash/hash_test.cc')
-rw-r--r-- | absl/hash/hash_test.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/absl/hash/hash_test.cc b/absl/hash/hash_test.cc index ffa45e6e..5b556180 100644 --- a/absl/hash/hash_test.cc +++ b/absl/hash/hash_test.cc @@ -222,7 +222,7 @@ TEST(HashValueTest, PointerAlignment) { // Limit the scope to the bits we would be using for Swisstable. constexpr size_t kMask = (1 << (kLog2NumValues + 7)) - 1; size_t stuck_bits = (~bits_or | bits_and) & kMask; - EXPECT_EQ(stuck_bits, 0) << "0x" << std::hex << stuck_bits; + EXPECT_EQ(stuck_bits, 0u) << "0x" << std::hex << stuck_bits; } } @@ -737,10 +737,10 @@ TEST(HashValueTest, CombinePiecewiseBuffer) { // // This test is run on a buffer that is a multiple of the stride size, and one // that isn't. - for (size_t big_buffer_size : {1024 * 2 + 512, 1024 * 3}) { + for (size_t big_buffer_size : {1024u * 2 + 512u, 1024u * 3}) { SCOPED_TRACE(big_buffer_size); std::string big_buffer; - for (int i = 0; i < big_buffer_size; ++i) { + for (size_t i = 0; i < big_buffer_size; ++i) { // Arbitrary string big_buffer.push_back(32 + (i * (i / 3)) % 64); } @@ -904,8 +904,8 @@ TEST(IsHashableTest, PoisonHash) { EXPECT_FALSE(absl::is_copy_assignable<absl::Hash<X>>::value); EXPECT_FALSE(absl::is_move_assignable<absl::Hash<X>>::value); EXPECT_FALSE(IsHashCallable<X>::value); -#if !defined(__GNUC__) || __GNUC__ < 9 - // This doesn't compile on GCC 9. +#if !defined(__GNUC__) || defined(__clang__) + // TODO(b/144368551): As of GCC 8.4 this does not compile. EXPECT_FALSE(IsAggregateInitializable<absl::Hash<X>>::value); #endif } @@ -1135,10 +1135,10 @@ TEST(HashTest, HashNonUniquelyRepresentedType) { unsigned char buffer2[kNumStructs * sizeof(StructWithPadding)]; std::memset(buffer2, 255, sizeof(buffer2)); auto* s2 = reinterpret_cast<StructWithPadding*>(buffer2); - for (int i = 0; i < kNumStructs; ++i) { + for (size_t i = 0; i < kNumStructs; ++i) { SCOPED_TRACE(i); - s1[i].c = s2[i].c = '0' + i; - s1[i].i = s2[i].i = i; + s1[i].c = s2[i].c = static_cast<char>('0' + i); + s1[i].i = s2[i].i = static_cast<int>(i); ASSERT_FALSE(memcmp(buffer1 + i * sizeof(StructWithPadding), buffer2 + i * sizeof(StructWithPadding), sizeof(StructWithPadding)) == 0) @@ -1226,7 +1226,9 @@ struct ValueWithBoolConversion { namespace std { template <> struct hash<ValueWithBoolConversion> { - size_t operator()(ValueWithBoolConversion v) { return v.i; } + size_t operator()(ValueWithBoolConversion v) { + return static_cast<size_t>(v.i); + } }; } // namespace std |