@@ -704,7 +704,7 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
704704 else if (i->isArray () && i->nameToken ()->previous ()->str () == " &" )
705705 type = Variables::referenceArray;
706706 else if (i->isArray ())
707- type = (i-> dimensions (). size () == 1U ) ? Variables::array : Variables::pointerArray ;
707+ type = Variables::array;
708708 else if (i->isReference () && !(i->valueType () && i->valueType ()->type == ValueType::UNKNOWN_TYPE && Token::simpleMatch (i->typeStartToken (), " auto" )))
709709 type = Variables::reference;
710710 else if (i->nameToken ()->previous ()->str () == " *" && i->nameToken ()->strAt (-2 ) == " *" )
@@ -1069,13 +1069,15 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
10691069 } else if (Token::Match (tok, " [(,] & %var% [,)]" )) {
10701070 variables.eraseAll (tok->tokAt (2 )->varId ());
10711071 } else if (Token::Match (tok, " [(,] (" ) &&
1072- Token::Match (tok->next ()->link (), " ) %var% [,)]" )) {
1072+ Token::Match (tok->next ()->link (), " ) %var% [,)[ ]" )) {
10731073 variables.use (tok->next ()->link ()->next ()->varId (), tok); // use = read + write
1074- } else if (Token::Match (tok, " [(,] *| %var% =" )) {
1075- tok = tok->next ();
1076- if (tok->str () == " *" )
1077- tok = tok->next ();
1078- variables.use (tok->varId (), tok);
1074+ } else if (Token::Match (tok, " [(,] *| *| %var%" )) {
1075+ const Token* vartok = tok->next ();
1076+ while (vartok->str () == " *" )
1077+ vartok = vartok->next ();
1078+ if (!(vartok->variable () && vartok == vartok->variable ()->nameToken ()) &&
1079+ !(tok->str () == " (" && !Token::Match (tok->previous (), " %name%" )))
1080+ variables.use (vartok->varId (), vartok);
10791081 }
10801082
10811083 // function
0 commit comments