Fixed ticket #228: false positive with usage of an auto-variable

This commit is contained in:
Gianluca Scacco 2009-03-28 21:47:38 +01:00
parent 6f7f8c4b4f
commit c88a362893
2 changed files with 11 additions and 5 deletions

View File

@ -154,12 +154,18 @@ void CheckAutoVariables::autoVariables()
fp_list.clear();
vd_list.clear();
}
else if (begin_function && begin_function_decl && Token::Match(tok, "%type% * %var%"))
else if (begin_function && begin_function_decl && Token::Match(tok, "%type% * * %var%"))
{
std::string var_name;
var_name = tok->tokAt(3)->str();
fp_list.push_back(var_name);
}
else if (begin_function && begin_function_decl && Token::Match(tok, "%type% * %var% ["))
{
std::string var_name;
var_name = tok->tokAt(2)->str();
//cout << "FP " << tok->linenr() << " " << var_name << endl;
fp_list.push_back(var_name);
}
else if (begin_function && Token::Match(tok, "("))

View File

@ -70,7 +70,7 @@ private:
void testautovar()
{
check("void func1(int *res)\n"
check("void func1(int **res)\n"
"{\n"
" int num=2;"
"res=&num;");