IncompleteStatement: Fixed false positive when '({..})' blocks are used
This commit is contained in:
parent
5c98e4d039
commit
9406f3428a
|
@ -1878,8 +1878,10 @@ void Tokenizer::simplifyExternC()
|
|||
void Tokenizer::simplifyRoundCurlyParentheses()
|
||||
{
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
while (Token::Match(tok, "[;{}] ( {") &&
|
||||
while (Token::Match(tok, "[;{}:] ( {") &&
|
||||
Token::simpleMatch(tok->linkAt(2), "} ) ;")) {
|
||||
if (tok->str() == ":" && !Token::Match(tok->tokAt(-2),"[;{}] %type% :"))
|
||||
break;
|
||||
Token *end = tok->linkAt(2)->tokAt(-3);
|
||||
if (Token::Match(end, "[;{}] %num%|%str% ;"))
|
||||
end->deleteNext(2);
|
||||
|
|
|
@ -245,6 +245,12 @@ private:
|
|||
" ({ do_something(); 0; });\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
"out:\n"
|
||||
" ({ do_something(); 0; });\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue