[Lldb-commits] [lldb] r263209 - Fix a bunch of signedness warnings in unittests
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 11 01:00:24 PST 2016
Author: labath
Date: Fri Mar 11 03:00:23 2016
New Revision: 263209
URL: http://llvm.org/viewvc/llvm-project?rev=263209&view=rev
Log:
Fix a bunch of signedness warnings in unittests
Modified:
lldb/trunk/unittests/Editline/EditlineTest.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/EditlineTest.cpp?rev=263209&r1=263208&r2=263209&view=diff
==============================================================================
--- lldb/trunk/unittests/Editline/EditlineTest.cpp (original)
+++ lldb/trunk/unittests/Editline/EditlineTest.cpp Fri Mar 11 03:00:23 2016
@@ -191,8 +191,9 @@ EditlineAdapter::SendLine (const std::st
eoln,
eoln_length * sizeof (char));
- EXPECT_EQ (eoln_length * sizeof (char), input_bytes_written);
- return eoln_length * sizeof (char) == input_bytes_written;
+ EXPECT_NE(-1, input_bytes_written) << strerror(errno);
+ EXPECT_EQ (eoln_length * sizeof (char), size_t(input_bytes_written));
+ return eoln_length * sizeof (char) == size_t(input_bytes_written);
}
bool
@@ -363,7 +364,7 @@ TEST_F(EditlineTestFixture, EditlineRece
EXPECT_EQ (input_lines.size (), el_reported_lines.GetSize ());
if (input_lines.size () == el_reported_lines.GetSize ())
{
- for (auto i = 0; i < input_lines.size(); ++i)
+ for (size_t i = 0; i < input_lines.size(); ++i)
EXPECT_EQ (input_lines[i], el_reported_lines[i]);
}
}
Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=263209&r1=263208&r2=263209&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Fri Mar 11 03:00:23 2016
@@ -108,7 +108,7 @@ protected:
bool
ContainsCompileUnit(const SymbolContextList &sc_list, const FileSpec &spec) const
{
- for (int i = 0; i < sc_list.GetSize(); ++i)
+ for (size_t i = 0; i < sc_list.GetSize(); ++i)
{
const SymbolContext &sc = sc_list[i];
if (FileSpecMatchesAsBaseOrFull(*sc.comp_unit, spec))
@@ -173,7 +173,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
FileSpec header_spec("test-pdb.cpp", false);
SymbolContextList sc_list;
uint32_t result_count = symfile->ResolveSymbolContext(header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_EQ(1, result_count);
+ EXPECT_EQ(1u, result_count);
EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
}
@@ -192,7 +192,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
FileSpec header_spec(R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec", false);
SymbolContextList sc_list;
uint32_t result_count = symfile->ResolveSymbolContext(header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_GE(1, result_count);
+ EXPECT_GE(1u, result_count);
EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
}
@@ -216,7 +216,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
{
SymbolContextList sc_list;
uint32_t result_count = symfile->ResolveSymbolContext(hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_EQ(2, result_count);
+ EXPECT_EQ(2u, result_count);
EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec));
EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec));
}
@@ -240,7 +240,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
{
SymbolContextList sc_list;
uint32_t result_count = symfile->ResolveSymbolContext(hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_EQ(0, result_count);
+ EXPECT_EQ(0u, result_count);
}
}
@@ -259,13 +259,13 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
FileSpec header1("test-pdb.h", false);
FileSpec header2("test-pdb-nested.h", false);
uint32_t cus = symfile->GetNumCompileUnits();
- EXPECT_EQ(2, cus);
+ EXPECT_EQ(2u, cus);
SymbolContextList sc_list;
uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
uint32_t count = symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list);
- EXPECT_EQ(1, count);
+ EXPECT_EQ(1u, count);
SymbolContext sc;
EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
@@ -273,7 +273,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
EXPECT_NE(nullptr, lt);
count = lt->GetSize();
// We expect one extra entry for termination (per function)
- EXPECT_EQ(16, count);
+ EXPECT_EQ(16u, count);
VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
VerifyLineEntry(module, sc, source_file, *lt, 8, 0x401043);
@@ -307,14 +307,14 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
FileSpec header1("test-pdb.h", false);
FileSpec header2("test-pdb-nested.h", false);
uint32_t cus = symfile->GetNumCompileUnits();
- EXPECT_EQ(2, cus);
+ EXPECT_EQ(2u, cus);
SymbolContextList sc_list;
uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
// First test with line 7, and verify that only line 7 entries are added.
uint32_t count = symfile->ResolveSymbolContext(source_file, 7, true, scope, sc_list);
- EXPECT_EQ(1, count);
+ EXPECT_EQ(1u, count);
SymbolContext sc;
EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
@@ -322,7 +322,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
EXPECT_NE(nullptr, lt);
count = lt->GetSize();
// We expect one extra entry for termination
- EXPECT_EQ(3, count);
+ EXPECT_EQ(3u, count);
VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
@@ -330,14 +330,14 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_
sc_list.Clear();
// Then test with line 9, and verify that only line 9 entries are added.
count = symfile->ResolveSymbolContext(source_file, 9, true, scope, sc_list);
- EXPECT_EQ(1, count);
+ EXPECT_EQ(1u, count);
EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
lt = sc.comp_unit->GetLineTable();
EXPECT_NE(nullptr, lt);
count = lt->GetSize();
// We expect one extra entry for termination
- EXPECT_EQ(3, count);
+ EXPECT_EQ(3u, count);
VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
More information about the lldb-commits
mailing list