additional tweaks to address some compiler warnings

This commit is contained in:
Vern Paxson 2021-09-14 11:45:50 -07:00
parent 693fc14eb2
commit 57fdef573c
6 changed files with 14 additions and 11 deletions

View file

@ -484,7 +484,7 @@ void ZAMCompiler::ReMapFrame()
frame1_to_frame2.resize(frame_layout1.size(), -1);
managed_slotsI.clear();
for ( unsigned int i = 0; i < insts1.size(); ++i )
for ( bro_uint_t i = 0; i < insts1.size(); ++i )
{
auto inst = insts1[i];
@ -659,7 +659,7 @@ void ZAMCompiler::ReMapInterpreterFrame()
remapped_intrp_frame_sizes[func] = next_interp_slot;
}
void ZAMCompiler::ReMapVar(ID* id, int slot, int inst)
void ZAMCompiler::ReMapVar(ID* id, int slot, bro_uint_t inst)
{
// A greedy algorithm for this is to simply find the first suitable
// frame slot. We do that with one twist: we also look for a
@ -686,7 +686,8 @@ void ZAMCompiler::ReMapVar(ID* id, int slot, int inst)
// ZAM instructions are careful to allow operands and
// assignment destinations to refer to the same slot.
if ( s.scope_end <= inst && s.is_managed == is_managed )
if ( s.scope_end <= static_cast<int>(inst) &&
s.is_managed == is_managed )
{ // It's compatible.
if ( s.scope_end == inst )
{ // It ends right on the money.
@ -727,7 +728,8 @@ void ZAMCompiler::ReMapVar(ID* id, int slot, int inst)
void ZAMCompiler::CheckSlotAssignment(int slot, const ZInstI* inst)
{
ASSERT(slot >= 0 && slot < frame_denizens.size());
ASSERT(slot >= 0 &&
static_cast<bro_uint_t>(slot) < frame_denizens.size());
// We construct temporaries such that their values are never used
// earlier than their definitions in loop bodies. For other
@ -766,7 +768,7 @@ void ZAMCompiler::CheckSlotUse(int slot, const ZInstI* inst)
if ( slot < 0 )
return;
ASSERT(slot < frame_denizens.size());
ASSERT(static_cast<bro_uint_t>(slot) < frame_denizens.size());
if ( denizen_beginning.count(slot) == 0 )
{

View file

@ -78,7 +78,7 @@ ZInstI* ZAMCompiler::FindLiveTarget(ZInstI* goto_target)
return goto_target;
int idx = goto_target->inst_num;
ASSERT(idx >= 0 && idx <= insts1.size());
ASSERT(idx >= 0 && idx <= int(insts1.size()));
while ( idx < int(insts1.size()) && ! insts1[idx]->live )
++idx;

View file

@ -450,7 +450,7 @@ private:
// Computes the remapping for a variable currently in the given slot,
// whose scope begins at the given instruction.
void ReMapVar(ID* id, int slot, int inst);
void ReMapVar(ID* id, int slot, bro_uint_t inst);
// Look to initialize the beginning of local lifetime based on slot
// assignment at instruction inst.

View file

@ -807,7 +807,7 @@ const ZAMStmt ZAMCompiler::LoopOverTable(const ForStmt* f, const NameExpr* val)
auto aux = new ZInstAux(0);
for ( auto i = 0U; i < loop_vars->length(); ++i )
for ( auto i = 0; i < loop_vars->length(); ++i )
{
auto id = (*loop_vars)[i];

View file

@ -225,7 +225,7 @@ string ZInst::VName(int n, int inst_num, const FrameReMap* mappings) const
return "<special>";
// Find which identifier manifests at this instruction.
ASSERT(slot >= 0 && slot < mappings->size());
ASSERT(slot >= 0 && static_cast<bro_uint_t>(slot) < mappings->size());
auto& map = (*mappings)[slot];
@ -327,7 +327,8 @@ string ZInstI::VName(int n, const FrameMap* frame_ids,
if ( remappings && live )
{ // Find which identifier manifests at this instruction.
ASSERT(slot >= 0 && slot < remappings->size());
ASSERT(slot >= 0 &&
static_cast<bro_uint_t>(slot) < remappings->size());
auto& map = (*remappings)[slot];

View file

@ -35,7 +35,7 @@ public:
// The ZAM instruction number where a given identifier starts its
// scope, parallel to "ids".
std::vector<int> id_start;
std::vector<bro_uint_t> id_start;
// The current end of the frame slot's scope. Gets updated as
// new IDs are added to share the slot.