prevent complaints about unused variables when they are used as var-param
This commit is contained in:
parent
2d79ecd203
commit
3891c03e0e
1 changed files with 13 additions and 10 deletions
|
@ -65,15 +65,16 @@ MarkUsed(nd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if( nd && nd->nd_class == Def ) {
|
if( nd && nd->nd_class == Def ) {
|
||||||
if( !((nd->nd_def->df_flags & D_VARPAR) ||
|
register struct def *df = nd->nd_def;
|
||||||
(nd->nd_def->df_kind == D_FIELD)) ) {
|
|
||||||
if( !(nd->nd_def->df_flags & D_SET) &&
|
if( df->df_kind != D_FIELD ) {
|
||||||
(nd->nd_def->df_scope == CurrentScope) )
|
if( !(df->df_flags & (D_SET|D_VARPAR)) &&
|
||||||
if( !is_anon_idf(nd->nd_def->df_idf) ) {
|
(df->df_scope == CurrentScope) )
|
||||||
|
if( !is_anon_idf(df->df_idf) ) {
|
||||||
warning("\"%s\" used before set",
|
warning("\"%s\" used before set",
|
||||||
nd->nd_def->df_idf->id_text);
|
df->df_idf->id_text);
|
||||||
}
|
}
|
||||||
nd->nd_def->df_flags |= (D_USED | D_SET);
|
df->df_flags |= (D_USED | D_SET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -779,15 +780,17 @@ getarg(argp, bases, varaccess, name, paramtp)
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
else if( varaccess ) {
|
else if( varaccess ) {
|
||||||
if( !ChkVarPar(left, name) )
|
if( !ChkVarPar(left, name) ) {
|
||||||
return 0;
|
MarkUsed(left);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( !ChkExpression(left) ) {
|
else if( !ChkExpression(left) ) {
|
||||||
MarkUsed(left);
|
MarkUsed(left);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !varaccess ) MarkUsed(left);
|
MarkUsed(left);
|
||||||
|
|
||||||
if( !varaccess && bases == T_INTEGER &&
|
if( !varaccess && bases == T_INTEGER &&
|
||||||
BaseType(left->nd_type)->tp_fund == T_LONG) {
|
BaseType(left->nd_type)->tp_fund == T_LONG) {
|
||||||
|
|
Loading…
Reference in a new issue