[llvm] r331978 - Fix signed/unsigned comparison warning and print format
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Thu May 10 05:15:43 PDT 2018
Author: jhenderson
Date: Thu May 10 05:15:43 2018
New Revision: 331978
URL: http://llvm.org/viewvc/llvm-project?rev=331978&view=rev
Log:
Fix signed/unsigned comparison warning and print format
The print format was causing at least 2 unit-test failures from r331971.
The signed/unsigned comparison warnings only appeared to affect two lines but
it was unclear whether it might just pop up on other lines, so I have been
explicit in all the literals in the tests.
There were other bot unit-test failures that I am still investigating.
Modified:
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=331978&r1=331977&r2=331978&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Thu May 10 05:15:43 2018
@@ -466,7 +466,7 @@ Expected<const DWARFDebugLine::LineTable
DWARFDataExtractor &DebugLineData, uint32_t Offset, const DWARFContext &Ctx,
const DWARFUnit *U, std::function<void(StringRef)> WarnCallback) {
if (!DebugLineData.isValidOffset(Offset))
- return createError("offset 0x%8.8" PRIx64
+ return createError("offset 0x%8.8" PRIx32
" is not a valid debug line section offset",
Offset);
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp?rev=331978&r1=331977&r2=331978&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp Thu May 10 05:15:43 2018
@@ -151,7 +151,7 @@ void checkDefaultPrologue(uint16_t Versi
case 4:
PrologueLength = 36;
UnitLength = PrologueLength + 2;
- EXPECT_EQ(Prologue.MaxOpsPerInst, 1);
+ EXPECT_EQ(Prologue.MaxOpsPerInst, 1u);
break;
case 2:
case 3:
@@ -161,8 +161,8 @@ void checkDefaultPrologue(uint16_t Versi
case 5:
PrologueLength = 39;
UnitLength = PrologueLength + 4;
- EXPECT_EQ(Prologue.getAddressSize(), 8);
- EXPECT_EQ(Prologue.SegSelectorSize, 0);
+ EXPECT_EQ(Prologue.getAddressSize(), 8u);
+ EXPECT_EQ(Prologue.SegSelectorSize, 0u);
break;
default:
llvm_unreachable("unsupported DWARF version");
@@ -171,17 +171,17 @@ void checkDefaultPrologue(uint16_t Versi
EXPECT_EQ(Prologue.TotalLength, UnitLength);
EXPECT_EQ(Prologue.PrologueLength, PrologueLength);
- EXPECT_EQ(Prologue.MinInstLength, 1);
- EXPECT_EQ(Prologue.DefaultIsStmt, 1);
+ EXPECT_EQ(Prologue.MinInstLength, 1u);
+ EXPECT_EQ(Prologue.DefaultIsStmt, 1u);
EXPECT_EQ(Prologue.LineBase, -5);
- EXPECT_EQ(Prologue.LineRange, 14);
- EXPECT_EQ(Prologue.OpcodeBase, 13);
+ EXPECT_EQ(Prologue.LineRange, 14u);
+ EXPECT_EQ(Prologue.OpcodeBase, 13u);
std::vector<uint8_t> ExpectedLengths = {0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1};
EXPECT_EQ(Prologue.StandardOpcodeLengths, ExpectedLengths);
- ASSERT_EQ(Prologue.IncludeDirectories.size(), 1);
+ ASSERT_EQ(Prologue.IncludeDirectories.size(), 1u);
ASSERT_EQ(Prologue.IncludeDirectories[0].getForm(), DW_FORM_string);
EXPECT_STREQ(*Prologue.IncludeDirectories[0].getAsCString(), "a dir");
- ASSERT_EQ(Prologue.FileNames.size(), 1);
+ ASSERT_EQ(Prologue.FileNames.size(), 1u);
ASSERT_EQ(Prologue.FileNames[0].Name.getForm(), DW_FORM_string);
EXPECT_STREQ(*Prologue.FileNames[0].Name.getAsCString(), "a file");
}
@@ -256,7 +256,7 @@ TEST_P(DebugLineParameterisedFixture, Ge
EXPECT_TRUE(IssueMessage.empty());
const DWARFDebugLine::LineTable *Expected2 = *ExpectedLineTable2;
checkDefaultPrologue(Version, Format, Expected2->Prologue, 32);
- EXPECT_EQ(Expected2->Sequences.size(), 2);
+ EXPECT_EQ(Expected2->Sequences.size(), 2u);
EXPECT_NE(Expected, Expected2);
@@ -470,20 +470,20 @@ TEST_F(DebugLineBasicFixture, ParserPars
DWARFDebugLine::SectionParser Parser = setupParser();
- EXPECT_EQ(Parser.getOffset(), 0);
+ EXPECT_EQ(Parser.getOffset(), 0u);
ASSERT_FALSE(Parser.done());
DWARFDebugLine::LineTable Parsed = Parser.parseNext(RecordIssue, RecordError);
checkDefaultPrologue(4, DWARF32, Parsed.Prologue, 16);
- EXPECT_EQ(Parsed.Sequences.size(), 1);
- EXPECT_EQ(Parser.getOffset(), 62);
+ EXPECT_EQ(Parsed.Sequences.size(), 1u);
+ EXPECT_EQ(Parser.getOffset(), 62u);
ASSERT_FALSE(Parser.done());
DWARFDebugLine::LineTable Parsed2 =
Parser.parseNext(RecordIssue, RecordError);
checkDefaultPrologue(4, DWARF64, Parsed2.Prologue, 16);
- EXPECT_EQ(Parsed2.Sequences.size(), 1);
- EXPECT_EQ(Parser.getOffset(), 136);
+ EXPECT_EQ(Parsed2.Sequences.size(), 1u);
+ EXPECT_EQ(Parser.getOffset(), 136u);
EXPECT_TRUE(Parser.done());
EXPECT_TRUE(IssueMessage.empty());
@@ -496,15 +496,15 @@ TEST_F(DebugLineBasicFixture, ParserSkip
DWARFDebugLine::SectionParser Parser = setupParser();
- EXPECT_EQ(Parser.getOffset(), 0);
+ EXPECT_EQ(Parser.getOffset(), 0u);
ASSERT_FALSE(Parser.done());
Parser.skip(RecordError);
- EXPECT_EQ(Parser.getOffset(), 62);
+ EXPECT_EQ(Parser.getOffset(), 62u);
ASSERT_FALSE(Parser.done());
Parser.skip(RecordError);
- EXPECT_EQ(Parser.getOffset(), 136);
+ EXPECT_EQ(Parser.getOffset(), 136u);
EXPECT_TRUE(Parser.done());
EXPECT_FALSE(FoundError);
@@ -532,7 +532,7 @@ TEST_F(DebugLineBasicFixture, ParserMove
DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs);
Parser.parseNext(RecordIssue, RecordError);
- EXPECT_EQ(Parser.getOffset(), 4);
+ EXPECT_EQ(Parser.getOffset(), 4u);
EXPECT_TRUE(Parser.done());
EXPECT_TRUE(IssueMessage.empty());
@@ -553,7 +553,7 @@ TEST_F(DebugLineBasicFixture, ParserMove
DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs);
Parser.skip(RecordError);
- EXPECT_EQ(Parser.getOffset(), 4);
+ EXPECT_EQ(Parser.getOffset(), 4u);
EXPECT_TRUE(Parser.done());
checkError("parsing line table prologue at offset 0x00000000 unsupported "
More information about the llvm-commits
mailing list