Variable usage : 2 more fixes

This commit is contained in:
Daniel Marjamäki 2008-12-09 07:25:00 +00:00
parent aaabacfe87
commit 20e28bb687
1 changed files with 4 additions and 1 deletions

View File

@ -844,7 +844,7 @@ static bool isOp(const TOKEN *tok)
tok->str() == ">" || tok->str() == ">" ||
tok->str() == ">=" || tok->str() == ">=" ||
tok->str() == "<<" || tok->str() == "<<" ||
TOKEN::Match(tok, "[+-*/&|,]"))); TOKEN::Match(tok, "[+-*/&|,[]]")));
} }
void CheckOther::functionVariableUsage() void CheckOther::functionVariableUsage()
@ -892,6 +892,9 @@ void CheckOther::functionVariableUsage()
if ((TOKEN::Match(tok,"[(=&!]") || isOp(tok)) && TOKEN::Match(tok->next(), "%var%")) if ((TOKEN::Match(tok,"[(=&!]") || isOp(tok)) && TOKEN::Match(tok->next(), "%var%"))
varUsage[ tok->strAt(1) ] |= USAGE_READ; varUsage[ tok->strAt(1) ] |= USAGE_READ;
if (TOKEN::Match(tok, "-=|+=|*=|/= %var%"))
varUsage[ tok->strAt(1) ] |= USAGE_READ;
if (TOKEN::Match(tok, "%var%") && (tok->next()->str()==")" || isOp(tok->next()))) if (TOKEN::Match(tok, "%var%") && (tok->next()->str()==")" || isOp(tok->next())))
varUsage[ tok->str() ] |= USAGE_READ; varUsage[ tok->str() ] |= USAGE_READ;