diff --git a/src/Attr.cc b/src/Attr.cc index d927af639c..1c203badc4 100644 --- a/src/Attr.cc +++ b/src/Attr.cc @@ -388,10 +388,10 @@ void Attributes::CheckAttr(Attr* a) int num_expires = 0; - for ( const auto& a : attrs ) + for ( const auto& at : attrs ) { - if ( a->Tag() == ATTR_EXPIRE_READ || a->Tag() == ATTR_EXPIRE_WRITE || - a->Tag() == ATTR_EXPIRE_CREATE ) + if ( at->Tag() == ATTR_EXPIRE_READ || at->Tag() == ATTR_EXPIRE_WRITE || + at->Tag() == ATTR_EXPIRE_CREATE ) num_expires++; } diff --git a/src/CompHash.cc b/src/CompHash.cc index 6eb39e67e7..f1b0ab7a85 100644 --- a/src/CompHash.cc +++ b/src/CompHash.cc @@ -333,9 +333,10 @@ bool CompositeHash::RecoverOneVal(const HashKey& hk, Type* t, ValPtr* pval, bool { ValPtr v; Attributes* a = rt->FieldDecl(i)->attrs.get(); - bool optional = (a && a->Find(ATTR_OPTIONAL)); + bool is_optional = (a && a->Find(ATTR_OPTIONAL)); - if ( ! RecoverOneVal(hk, rt->GetFieldType(i).get(), &v, optional, false) ) + if ( ! RecoverOneVal(hk, rt->GetFieldType(i).get(), &v, is_optional, + false) ) { *pval = nullptr; return false; @@ -345,7 +346,7 @@ bool CompositeHash::RecoverOneVal(const HashKey& hk, Type* t, ValPtr* pval, bool // abort() and broken the call tree that clang-tidy is relying on to // get the error described. // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch) - if ( ! (v || optional) ) + if ( ! (v || is_optional) ) { reporter->InternalError( "didn't recover expected number of fields from HashKey"); diff --git a/src/Stmt.cc b/src/Stmt.cc index f017301c63..7f06ffca4e 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -256,8 +256,8 @@ ExprListStmt::ExprListStmt(StmtTag t, ListExprPtr arg_l) : Stmt(t), l(std::move( const ExprPList& e = l->Exprs(); for ( const auto& expr : e ) { - const auto& t = expr->GetType(); - if ( ! t || t->Tag() == TYPE_VOID ) + const auto& et = expr->GetType(); + if ( ! et || et->Tag() == TYPE_VOID ) Error("value of type void illegal"); } diff --git a/src/Val.cc b/src/Val.cc index 67b4c94744..d0091d35f5 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -1396,13 +1396,13 @@ TableVal::TableVal(TableTypePtr t, detail::AttributesPtr a) : Val(t) if ( ! run_state::is_parsing ) return; - for ( const auto& t : table_type->GetIndexTypes() ) + for ( const auto& it : table_type->GetIndexTypes() ) { std::set found; std::set analyzed_records; // TODO: this likely doesn't have to be repeated for each new TableVal, // can remember the resulting dependencies per TableType - find_nested_record_types(t, &found, &analyzed_records); + find_nested_record_types(it, &found, &analyzed_records); for ( auto rt : found ) parse_time_table_record_dependencies[rt].emplace_back(NewRef{}, this); diff --git a/src/analyzer/protocol/rpc/Portmap.cc b/src/analyzer/protocol/rpc/Portmap.cc index 94b9f4e603..f75037d74a 100644 --- a/src/analyzer/protocol/rpc/Portmap.cc +++ b/src/analyzer/protocol/rpc/Portmap.cc @@ -94,11 +94,11 @@ bool PortmapperInterp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status statu case PMAPPROC_SET: if ( success ) { - uint32_t status = extract_XDR_uint32(buf, n); + uint32_t proc_status = extract_XDR_uint32(buf, n); if ( ! buf ) return false; - reply = val_mgr->Bool(status); + reply = val_mgr->Bool(proc_status); event = pm_request_set; } else @@ -109,11 +109,11 @@ bool PortmapperInterp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status statu case PMAPPROC_UNSET: if ( success ) { - uint32_t status = extract_XDR_uint32(buf, n); + uint32_t proc_status = extract_XDR_uint32(buf, n); if ( ! buf ) return false; - reply = val_mgr->Bool(status); + reply = val_mgr->Bool(proc_status); event = pm_request_unset; } else diff --git a/src/input/readers/sqlite/SQLite.cc b/src/input/readers/sqlite/SQLite.cc index a415377cda..4e63674a86 100644 --- a/src/input/readers/sqlite/SQLite.cc +++ b/src/input/readers/sqlite/SQLite.cc @@ -207,9 +207,9 @@ Value* SQLite::EntryToVal(sqlite3_stmt* st, const threading::Field* field, int p { const char* text = (const char*)sqlite3_column_text(st, pos); std::string s(text, sqlite3_column_bytes(st, pos)); - int pos = s.find('/'); - int width = atoi(s.substr(pos + 1).c_str()); - std::string addr = s.substr(0, pos); + size_t slash_pos = s.find('/'); + int width = atoi(s.substr(slash_pos + 1).c_str()); + std::string addr = s.substr(0, slash_pos); val->val.subnet_val.prefix = io->ParseAddr(addr); val->val.subnet_val.length = width; diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index 1947828449..63983f64fe 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -1209,9 +1209,9 @@ WriterFrontend* Manager::CreateWriter(EnumVal* id, EnumVal* writer, WriterBacken if ( ! found_filter_match ) { - const auto& id = zeek::detail::global_scope()->Find("Log::default_rotation_interval"); + const auto& interval = zeek::detail::global_scope()->Find("Log::default_rotation_interval"); assert(id); - winfo->interval = id->GetVal()->AsInterval(); + winfo->interval = interval->GetVal()->AsInterval(); if ( winfo->info->post_proc_func && strlen(winfo->info->post_proc_func) ) { diff --git a/src/script_opt/Stmt.cc b/src/script_opt/Stmt.cc index 2e01d66002..2ad284d348 100644 --- a/src/script_opt/Stmt.cc +++ b/src/script_opt/Stmt.cc @@ -1005,8 +1005,8 @@ StmtPtr CatchReturnStmt::DoReduce(Reducer* c) if ( ret_e_dup->Tag() == EXPR_CONST ) { - auto c = ret_e_dup->AsConstExpr(); - rv_dup->AsNameExpr()->Id()->GetOptInfo()->SetConst(c); + auto ce = ret_e_dup->AsConstExpr(); + rv_dup->AsNameExpr()->Id()->GetOptInfo()->SetConst(ce); } return assign_stmt; diff --git a/src/script_opt/ZAM/Stmt.cc b/src/script_opt/ZAM/Stmt.cc index 289eec3cfd..7bf47a8dc0 100644 --- a/src/script_opt/ZAM/Stmt.cc +++ b/src/script_opt/ZAM/Stmt.cc @@ -480,13 +480,13 @@ const ZAMStmt ZAMCompiler::ValueSwitch(const SwitchStmt* sw, const NameExpr* v, std::vector case_start; PushFallThroughs(); - for ( auto c : *cases ) + for ( auto sw_case : *cases ) { auto start = GoToTargetBeyond(body_end); ResolveFallThroughs(start); case_start.push_back(start); PushFallThroughs(); - body_end = CompileStmt(c->Body()); + body_end = CompileStmt(sw_case->Body()); } auto sw_end = GoToTargetBeyond(body_end); diff --git a/src/supervisor/Supervisor.cc b/src/supervisor/Supervisor.cc index d9eed4e69b..4dde94d4cf 100644 --- a/src/supervisor/Supervisor.cc +++ b/src/supervisor/Supervisor.cc @@ -1173,8 +1173,8 @@ std::optional Supervisor::CreateStem(bool supervisor_mode) ss.pipe = std::make_unique(FD_CLOEXEC, O_NONBLOCK, fds); ss.parent_pid = stem_ppid; - Stem stem{std::move(ss)}; - supervised_node = stem.Run(); + Stem new_stem{std::move(ss)}; + supervised_node = new_stem.Run(); return {}; } @@ -1195,8 +1195,8 @@ std::optional Supervisor::CreateStem(bool supervisor_mode) if ( pid == 0 ) { - Stem stem{std::move(ss)}; - supervised_node = stem.Run(); + Stem new_stem{std::move(ss)}; + supervised_node = new_stem.Run(); return {}; }