AST: fix hang for code 'MACRO({.x=1,.y=2})'

This commit is contained in:
Daniel Marjamäki 2014-08-25 19:10:16 +02:00
parent 67ea470275
commit cd75b2d83d
2 changed files with 5 additions and 0 deletions

View File

@ -895,6 +895,8 @@ static Token * createAstAtToken(Token *tok, bool cpp)
continue;
if (tok->next() == endToken)
break;
if (Token::simpleMatch(tok, "( { ."))
break;
const Token * const endToken2 = tok->linkAt(1);
for (; tok && tok != endToken && tok != endToken2; tok = tok ? tok->next() : NULL)
tok = createAstAtToken(tok, cpp);

View File

@ -10755,6 +10755,9 @@ private:
ASSERT_EQUALS("QT_WA{{,( QT_WA{{,( x1=",
testAst("QT_WA({},{x=0;});" // don't hang
"QT_WA({x=1;},{x=2;});"));
ASSERT_EQUALS("xMACROtypeT=value1=,{({=",
testAst("x = { MACRO( { .type=T, .value=1 } ) }")); // dont hang: MACRO({..})
// function pointer
TODO_ASSERT_EQUALS("todo", "va_argapvoid((,(*0=", testAst("*va_arg(ap, void(**) ()) = 0;"));