diff --git a/.clang-tidy b/.clang-tidy index bfa2a00f91..cfe3c518f5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -15,4 +15,5 @@ Checks: [-*, bugprone-suspicious-include, bugprone-suspicious-realloc-usage, bugprone-throw-keyword-missing, + bugprone-unused-local-non-trivial-variable, ] diff --git a/src/Reporter.cc b/src/Reporter.cc index 43510b315f..88a1502972 100644 --- a/src/Reporter.cc +++ b/src/Reporter.cc @@ -485,7 +485,6 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Conne std::string loc_str; if ( location ) { - std::string loc_file = ""; int loc_line = 0; if ( locations.size() ) { diff --git a/src/analyzer/protocol/imap/imap-protocol.pac b/src/analyzer/protocol/imap/imap-protocol.pac index b1964b2bb8..0088dbe06f 100644 --- a/src/analyzer/protocol/imap/imap-protocol.pac +++ b/src/analyzer/protocol/imap/imap-protocol.pac @@ -53,7 +53,6 @@ refine connection IMAP_Conn += { %{ string cmdstr = std_str(command); std::transform(cmdstr.begin(), cmdstr.end(), cmdstr.begin(), ::tolower); - string tagstr = std_str(tag); if ( !is_orig && cmdstr == "capability" && tag == "*" ) { return CMD_CAPABILITY; diff --git a/src/input/readers/raw/Raw.cc b/src/input/readers/raw/Raw.cc index 2660cc8912..6dec5c6bcd 100644 --- a/src/input/readers/raw/Raw.cc +++ b/src/input/readers/raw/Raw.cc @@ -607,7 +607,6 @@ bool Raw::DoUpdate() { } } - std::string line; assert((NumFields() == 1 && ! use_stderr) || (NumFields() == 2 && use_stderr)); for ( ;; ) { if ( stdin_towrite > 0 ) diff --git a/src/script_opt/CPP/Consts.cc b/src/script_opt/CPP/Consts.cc index 41428b2053..919533edd0 100644 --- a/src/script_opt/CPP/Consts.cc +++ b/src/script_opt/CPP/Consts.cc @@ -63,7 +63,6 @@ shared_ptr CPPCompile::RegisterConstant(const ValPtr& vp, int& con } auto tag = t->Tag(); - auto const_name = const_info[tag]->NextName(); shared_ptr gi; switch ( tag ) { diff --git a/src/script_opt/CPP/Exprs.cc b/src/script_opt/CPP/Exprs.cc index c9ad33122c..6c8fc1579f 100644 --- a/src/script_opt/CPP/Exprs.cc +++ b/src/script_opt/CPP/Exprs.cc @@ -1241,7 +1241,6 @@ string CPPCompile::GenField(const ExprPtr& rec, int field) { auto pt = processed_types.find(rt); ASSERT(pt != processed_types.end()); auto rt_offset = pt->second->Offset(); - string field_name = rt->FieldName(field); field_decls.emplace_back(rt_offset, rt->FieldDecl(field)); if ( rfm != record_field_mappings.end() ) diff --git a/src/script_opt/CPP/InitsInfo.cc b/src/script_opt/CPP/InitsInfo.cc index 2500b42806..d63e1a45de 100644 --- a/src/script_opt/CPP/InitsInfo.cc +++ b/src/script_opt/CPP/InitsInfo.cc @@ -491,7 +491,6 @@ ListTypeInfo::ListTypeInfo(CPPCompile* _c, TypePtr _t) } void ListTypeInfo::AddInitializerVals(std::vector& ivs) const { - string type_list; for ( auto& t : types ) { auto iv = Fmt(c->TypeOffset(t)); ivs.emplace_back(iv); diff --git a/src/script_opt/CSE.cc b/src/script_opt/CSE.cc index de2d542a40..e1bf0518c7 100644 --- a/src/script_opt/CSE.cc +++ b/src/script_opt/CSE.cc @@ -255,7 +255,6 @@ bool CSE_ValidityChecker::CheckTableRef(const TypePtr& t) { return CheckSideEffe bool CSE_ValidityChecker::CheckCall(const CallExpr* c) { auto func = c->Func(); - std::string desc; if ( func->Tag() != EXPR_NAME ) // Can't analyze indirect calls. return Invalid();