mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Fix LGTM warnings in script_opt/CPP code
i.e. shadowed variables and "missing return values" (scare quotes)
This commit is contained in:
parent
ac257e4a86
commit
1b825c51de
3 changed files with 18 additions and 11 deletions
|
@ -219,12 +219,12 @@ string CPPCompile::BindArgs(const FuncTypePtr& ft, const IDPList* lambda_ids)
|
||||||
for ( auto i = 0; i < n; ++i )
|
for ( auto i = 0; i < n; ++i )
|
||||||
{
|
{
|
||||||
auto arg_i = string("f->GetElement(") + Fmt(i) + ")";
|
auto arg_i = string("f->GetElement(") + Fmt(i) + ")";
|
||||||
const auto& ft = params->GetFieldType(i);
|
const auto& pt = params->GetFieldType(i);
|
||||||
|
|
||||||
if ( IsNativeType(ft) )
|
if ( IsNativeType(pt) )
|
||||||
res += arg_i + NativeAccessor(ft);
|
res += arg_i + NativeAccessor(pt);
|
||||||
else
|
else
|
||||||
res += GenericValPtrToGT(arg_i, ft, GEN_VAL_PTR);
|
res += GenericValPtrToGT(arg_i, pt, GEN_VAL_PTR);
|
||||||
|
|
||||||
res += ", ";
|
res += ", ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -620,11 +620,11 @@ string CPPCompile::GenRecordConstructorExpr(const Expr* e)
|
||||||
|
|
||||||
for ( auto i = 0; i < n; ++i )
|
for ( auto i = 0; i < n; ++i )
|
||||||
{
|
{
|
||||||
const auto& e = exprs[i];
|
const auto& expr = exprs[i];
|
||||||
|
|
||||||
ASSERT(e->Tag() == EXPR_FIELD_ASSIGN);
|
ASSERT(expr->Tag() == EXPR_FIELD_ASSIGN);
|
||||||
|
|
||||||
vals += GenExpr(e->GetOp1(), GEN_VAL_PTR);
|
vals += GenExpr(expr->GetOp1(), GEN_VAL_PTR);
|
||||||
|
|
||||||
if ( i < n - 1 )
|
if ( i < n - 1 )
|
||||||
vals += ", ";
|
vals += ", ";
|
||||||
|
@ -668,12 +668,12 @@ string CPPCompile::GenTableConstructorExpr(const Expr* e)
|
||||||
|
|
||||||
for ( auto i = 0; i < n; ++i )
|
for ( auto i = 0; i < n; ++i )
|
||||||
{
|
{
|
||||||
const auto& e = exprs[i];
|
const auto& expr = exprs[i];
|
||||||
|
|
||||||
ASSERT(e->Tag() == EXPR_ASSIGN);
|
ASSERT(expr->Tag() == EXPR_ASSIGN);
|
||||||
|
|
||||||
auto index = e->GetOp1();
|
auto index = expr->GetOp1();
|
||||||
auto v = e->GetOp2();
|
auto v = expr->GetOp2();
|
||||||
|
|
||||||
if ( index->Tag() == EXPR_LIST )
|
if ( index->Tag() == EXPR_LIST )
|
||||||
// Multiple indices.
|
// Multiple indices.
|
||||||
|
|
|
@ -44,6 +44,7 @@ bool CPPCompile::IsNativeType(const TypePtr& t) const
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::IsNativeType");
|
reporter->InternalError("bad type in CPPCompile::IsNativeType");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +288,7 @@ const char* CPPCompile::TypeTagName(TypeTag tag) const
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::TypeTagName");
|
reporter->InternalError("bad type in CPPCompile::TypeTagName");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,6 +320,7 @@ const char* CPPCompile::TypeName(const TypePtr& t)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::TypeName");
|
reporter->InternalError("bad type in CPPCompile::TypeName");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +356,7 @@ const char* CPPCompile::FullTypeName(const TypePtr& t)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::FullTypeName");
|
reporter->InternalError("bad type in CPPCompile::FullTypeName");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,6 +369,7 @@ const char* CPPCompile::TypeType(const TypePtr& t)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::TypeType");
|
reporter->InternalError("bad type in CPPCompile::TypeType");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,6 +547,7 @@ const char* CPPCompile::NativeAccessor(const TypePtr& t)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::NativeAccessor");
|
reporter->InternalError("bad type in CPPCompile::NativeAccessor");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +578,7 @@ const char* CPPCompile::IntrusiveVal(const TypePtr& t)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in CPPCompile::IntrusiveVal");
|
reporter->InternalError("bad type in CPPCompile::IntrusiveVal");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue