diff --git a/src/Stmt.h b/src/Stmt.h index b8e52860b8..d79a8631fb 100644 --- a/src/Stmt.h +++ b/src/Stmt.h @@ -471,7 +471,7 @@ protected: std::vector stmts; // Optimization-related: - bool ReduceStmt(int& s_i, std::vector& f_stmts, Reducer* c); + bool ReduceStmt(unsigned int& s_i, std::vector& f_stmts, Reducer* c); void ResetStmts(std::vector new_stmts) { stmts = std::move(new_stmts); } }; diff --git a/src/script_opt/CPP/Types.cc b/src/script_opt/CPP/Types.cc index 6b72851f83..f97987a9e9 100644 --- a/src/script_opt/CPP/Types.cc +++ b/src/script_opt/CPP/Types.cc @@ -114,7 +114,7 @@ const char* CPPCompile::TypeName(const TypePtr& t) { case TYPE_BOOL: return "bool"; case TYPE_COUNT: return "zeek_uint_t"; case TYPE_DOUBLE: return "double"; - case TYPE_ENUM: return "int"; + case TYPE_ENUM: return "zeek_int_t"; case TYPE_INT: return "zeek_int_t"; case TYPE_INTERVAL: return "double"; case TYPE_PORT: return "zeek_uint_t"; diff --git a/src/script_opt/Stmt.cc b/src/script_opt/Stmt.cc index 7cb59cd6c6..444bda789f 100644 --- a/src/script_opt/Stmt.cc +++ b/src/script_opt/Stmt.cc @@ -632,7 +632,7 @@ void StmtList::Inline(Inliner* inl) { bool StmtList::IsReduced(Reducer* c) const { auto n = stmts.size(); - for ( auto i = 0; i < n; ++i ) { + for ( auto i = 0U; i < n; ++i ) { auto& s_i = stmts[i]; if ( ! s_i->IsReduced(c) ) return false; @@ -650,7 +650,7 @@ StmtPtr StmtList::DoReduce(Reducer* c) { auto n = stmts.size(); - for ( auto i = 0; i < n; ++i ) { + for ( auto i = 0U; i < n; ++i ) { if ( ReduceStmt(i, f_stmts, c) ) did_change = true; @@ -677,7 +677,7 @@ StmtPtr StmtList::DoReduce(Reducer* c) { return ThisPtr(); } -bool StmtList::ReduceStmt(int& s_i, std::vector& f_stmts, Reducer* c) { +bool StmtList::ReduceStmt(unsigned int& s_i, std::vector& f_stmts, Reducer* c) { bool did_change = false; auto& stmt_i = stmts[s_i]; auto old_stmt = stmt_i.get(); diff --git a/src/script_opt/UseDefs.cc b/src/script_opt/UseDefs.cc index b491886021..855d7145f3 100644 --- a/src/script_opt/UseDefs.cc +++ b/src/script_opt/UseDefs.cc @@ -182,7 +182,7 @@ UDs UseDefs::PropagateUDs(const Stmt* s, UDs succ_UDs, const Stmt* succ_stmt, bo const Stmt* succ; - if ( i == stmts.size() - 1 ) { // Very last statement. + if ( i == int(stmts.size()) - 1 ) { // Very last statement. succ = succ_stmt; if ( successor2.find(s) != successor2.end() ) successor2[s_i] = successor2[s]; diff --git a/src/script_opt/ZAM/Ops.in b/src/script_opt/ZAM/Ops.in index 0a774fa4f4..e407676ba4 100644 --- a/src/script_opt/ZAM/Ops.in +++ b/src/script_opt/ZAM/Ops.in @@ -981,7 +981,7 @@ macro EvalIndexVec(index) zeek_int_t ind = index; if ( ind < 0 ) ind += vv.size(); - if ( ind < 0 || ind >= vv.size() ) + if ( ind < 0 || ind >= int(vv.size()) ) ZAM_run_time_error(z.loc, "no such index"); AssignV1(CopyVal(*vec[ind])) @@ -998,7 +998,7 @@ macro EvalIndexAnyVec(index) zeek_int_t ind = index; if ( ind < 0 ) ind += vv->Size(); - if ( ind < 0 || ind >= vv->Size() ) + if ( ind < 0 || ind >= int(vv->Size()) ) ZAM_run_time_error(z.loc, "no such index"); AssignV1(ZVal(vv->ValAt(ind).release())) diff --git a/src/script_opt/ZAM/ZBody.cc b/src/script_opt/ZAM/ZBody.cc index 0643801d09..42db4a58f4 100644 --- a/src/script_opt/ZAM/ZBody.cc +++ b/src/script_opt/ZAM/ZBody.cc @@ -233,7 +233,7 @@ ValPtr ZBody::Exec(Frame* f, StmtFlowType& flow) { } ValPtr ZBody::DoExec(Frame* f, StmtFlowType& flow) { - int pc = 0; + unsigned int pc = 0; // Return value, or nil if none. const ZVal* ret_u = nullptr;