1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[unittests] Fix "comparison of integers of different signs" warnings

A warning is sent because `std::distance()` returns a signed type so
`CmpHelperEQ()` gets instantiated into a function that compares
differently signed arguments.

Differential Revision: https://reviews.llvm.org/D72632
This commit is contained in:
Miloš Stojanović 2020-01-13 19:27:03 +01:00
parent 4630ee3150
commit cca0a0ee45
2 changed files with 5 additions and 6 deletions

View File

@ -56,17 +56,17 @@ TEST(LinkGraphTest, BlockAndSymbolIteration) {
false, false);
// Check that iteration of blocks within a section behaves as expected.
EXPECT_EQ(std::distance(Sec1.blocks().begin(), Sec1.blocks().end()), 2U);
EXPECT_EQ(std::distance(Sec1.blocks().begin(), Sec1.blocks().end()), 2);
EXPECT_TRUE(llvm::count(Sec1.blocks(), &B1));
EXPECT_TRUE(llvm::count(Sec1.blocks(), &B2));
// Check that iteration of symbols within a section behaves as expected.
EXPECT_EQ(std::distance(Sec1.symbols().begin(), Sec1.symbols().end()), 2U);
EXPECT_EQ(std::distance(Sec1.symbols().begin(), Sec1.symbols().end()), 2);
EXPECT_TRUE(llvm::count(Sec1.symbols(), &S1));
EXPECT_TRUE(llvm::count(Sec1.symbols(), &S2));
// Check that iteration of blocks across sections behaves as expected.
EXPECT_EQ(std::distance(G.blocks().begin(), G.blocks().end()), 4U);
EXPECT_EQ(std::distance(G.blocks().begin(), G.blocks().end()), 4);
EXPECT_TRUE(llvm::count(G.blocks(), &B1));
EXPECT_TRUE(llvm::count(G.blocks(), &B2));
EXPECT_TRUE(llvm::count(G.blocks(), &B3));
@ -75,8 +75,7 @@ TEST(LinkGraphTest, BlockAndSymbolIteration) {
// Check that iteration of defined symbols across sections behaves as
// expected.
EXPECT_EQ(
std::distance(G.defined_symbols().begin(), G.defined_symbols().end()),
4U);
std::distance(G.defined_symbols().begin(), G.defined_symbols().end()), 4);
EXPECT_TRUE(llvm::count(G.defined_symbols(), &S1));
EXPECT_TRUE(llvm::count(G.defined_symbols(), &S2));
EXPECT_TRUE(llvm::count(G.defined_symbols(), &S3));

View File

@ -589,7 +589,7 @@ TEST(MinidumpFile, getMemoryInfoList) {
const MinidumpFile &File = **ExpectedFile;
auto ExpectedInfo = File.getMemoryInfoList();
ASSERT_THAT_EXPECTED(ExpectedInfo, Succeeded());
ASSERT_EQ(1u, std::distance(ExpectedInfo->begin(), ExpectedInfo->end()));
ASSERT_EQ(1, std::distance(ExpectedInfo->begin(), ExpectedInfo->end()));
const MemoryInfo &Info = *ExpectedInfo.get().begin();
EXPECT_EQ(0x0706050403020100u, Info.BaseAddress);
EXPECT_EQ(0x0504030201000908u, Info.AllocationBase);