fixed a hang in Tokenizer::simplifyFunctionParameters

This commit is contained in:
Daniel Marjamäki 2009-12-31 19:31:21 +01:00
parent 774e331dea
commit e0ecef5d71
2 changed files with 6 additions and 9 deletions

View File

@ -3042,15 +3042,7 @@ void Tokenizer::simplifyFunctionParameters()
{
for (Token *tok = _tokens; tok; tok = tok->next())
{
if (tok->str() == "{")
{
tok = tok->link();
if (!tok)
break;
continue;
}
if (tok->str() == "(")
if (tok->str() == "{" || tok->str() == "[" || tok->str() == "(")
{
tok = tok->link();
if (!tok)

View File

@ -1934,6 +1934,11 @@ private:
void simplify_function_parameters()
{
{
const char code[] = "char a [ ABC ( DEF ) ] ;";
ASSERT_EQUALS(code, tokenizeAndStringify(code, true));
}
ASSERT_EQUALS("void f ( int x ) { }", tokenizeAndStringify("void f(x) int x; { }", true));
ASSERT_EQUALS("void f ( int x , char y ) { }", tokenizeAndStringify("void f(x,y) int x; char y; { }", true));