mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
additional tweaks to address some compiler warnings
This commit is contained in:
parent
693fc14eb2
commit
57fdef573c
6 changed files with 14 additions and 11 deletions
|
@ -484,7 +484,7 @@ void ZAMCompiler::ReMapFrame()
|
||||||
frame1_to_frame2.resize(frame_layout1.size(), -1);
|
frame1_to_frame2.resize(frame_layout1.size(), -1);
|
||||||
managed_slotsI.clear();
|
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];
|
auto inst = insts1[i];
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ void ZAMCompiler::ReMapInterpreterFrame()
|
||||||
remapped_intrp_frame_sizes[func] = next_interp_slot;
|
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
|
// 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
|
// 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
|
// ZAM instructions are careful to allow operands and
|
||||||
// assignment destinations to refer to the same slot.
|
// 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.
|
{ // It's compatible.
|
||||||
if ( s.scope_end == inst )
|
if ( s.scope_end == inst )
|
||||||
{ // It ends right on the money.
|
{ // 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)
|
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
|
// We construct temporaries such that their values are never used
|
||||||
// earlier than their definitions in loop bodies. For other
|
// earlier than their definitions in loop bodies. For other
|
||||||
|
@ -766,7 +768,7 @@ void ZAMCompiler::CheckSlotUse(int slot, const ZInstI* inst)
|
||||||
if ( slot < 0 )
|
if ( slot < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(slot < frame_denizens.size());
|
ASSERT(static_cast<bro_uint_t>(slot) < frame_denizens.size());
|
||||||
|
|
||||||
if ( denizen_beginning.count(slot) == 0 )
|
if ( denizen_beginning.count(slot) == 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ ZInstI* ZAMCompiler::FindLiveTarget(ZInstI* goto_target)
|
||||||
return goto_target;
|
return goto_target;
|
||||||
|
|
||||||
int idx = goto_target->inst_num;
|
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 )
|
while ( idx < int(insts1.size()) && ! insts1[idx]->live )
|
||||||
++idx;
|
++idx;
|
||||||
|
|
|
@ -450,7 +450,7 @@ private:
|
||||||
|
|
||||||
// Computes the remapping for a variable currently in the given slot,
|
// Computes the remapping for a variable currently in the given slot,
|
||||||
// whose scope begins at the given instruction.
|
// 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
|
// Look to initialize the beginning of local lifetime based on slot
|
||||||
// assignment at instruction inst.
|
// assignment at instruction inst.
|
||||||
|
|
|
@ -807,7 +807,7 @@ const ZAMStmt ZAMCompiler::LoopOverTable(const ForStmt* f, const NameExpr* val)
|
||||||
|
|
||||||
auto aux = new ZInstAux(0);
|
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];
|
auto id = (*loop_vars)[i];
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ string ZInst::VName(int n, int inst_num, const FrameReMap* mappings) const
|
||||||
return "<special>";
|
return "<special>";
|
||||||
|
|
||||||
// Find which identifier manifests at this instruction.
|
// 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];
|
auto& map = (*mappings)[slot];
|
||||||
|
|
||||||
|
@ -327,7 +327,8 @@ string ZInstI::VName(int n, const FrameMap* frame_ids,
|
||||||
|
|
||||||
if ( remappings && live )
|
if ( remappings && live )
|
||||||
{ // Find which identifier manifests at this instruction.
|
{ // 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];
|
auto& map = (*remappings)[slot];
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
// The ZAM instruction number where a given identifier starts its
|
// The ZAM instruction number where a given identifier starts its
|
||||||
// scope, parallel to "ids".
|
// 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
|
// The current end of the frame slot's scope. Gets updated as
|
||||||
// new IDs are added to share the slot.
|
// new IDs are added to share the slot.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue