Fixed ticket #564 (set variable id for "struct ABC **p")

http://sourceforge.net/apps/trac/cppcheck/ticket/564
This commit is contained in:
Reijo Tomperi 2009-08-07 00:31:39 +03:00
parent 80953633ee
commit d719606201
2 changed files with 17 additions and 1 deletions

View File

@ -2263,7 +2263,7 @@ bool Tokenizer::simplifyVarDecl()
Token *tok2 = type0;
unsigned int typelen = 1;
while (Token::Match(tok2, "%type% %type% *| %var%"))
while (Token::Match(tok2, "%type% %type% *| *| %var%"))
{
if (tok2->str() == "const")
isconst = true;

View File

@ -1031,6 +1031,22 @@ private:
ASSERT_EQUALS(" void foo ( ) { char * a ; char * b ; delete a ; delete b ; }", sizeof_(code));
}
{
const char code[] = "void foo()\n"
"{\n"
" struct A *a, *b;\n"
"}\n";
ASSERT_EQUALS(" void foo ( ) { struct A * a ; struct A * b ; }", sizeof_(code));
}
{
const char code[] = "void foo()\n"
"{\n"
" struct A **a, **b;\n"
"}\n";
ASSERT_EQUALS(" void foo ( ) { struct A * * a ; struct A * * b ; }", sizeof_(code));
}
{
const char code[] = "void foo()\n"
"{\n"