Fixed #2505 (Check processing of a preprocessor macro 'FREE')

This commit is contained in:
Daniel Marjamäki 2011-01-28 09:19:30 +01:00
parent 79862573ba
commit 83625d8055
2 changed files with 8 additions and 1 deletions

View File

@ -6846,7 +6846,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
ret = true; ret = true;
} }
while (Token::Match(tok->previous(), "[;{(] ( %var% (") && while (Token::Match(tok->previous(), "[,;{}(] ( %var% (") &&
tok->link()->previous() == tok->tokAt(2)->link()) tok->link()->previous() == tok->tokAt(2)->link())
{ {
// We have "( func ( *something* ))", remove the outer // We have "( func ( *something* ))", remove the outer

View File

@ -205,6 +205,7 @@ private:
TEST_CASE(removeParantheses8); // Ticket #1865 TEST_CASE(removeParantheses8); // Ticket #1865
TEST_CASE(removeParantheses9); // Ticket #1962 TEST_CASE(removeParantheses9); // Ticket #1962
TEST_CASE(removeParantheses10); // Ticket #2320 TEST_CASE(removeParantheses10); // Ticket #2320
TEST_CASE(removeParantheses11); // Ticket #2505
TEST_CASE(tokenize_double); TEST_CASE(tokenize_double);
TEST_CASE(tokenize_strings); TEST_CASE(tokenize_strings);
@ -3688,6 +3689,12 @@ private:
ASSERT_EQUALS("p = buf + 8 ;", tokenizeAndStringify("p = (buf + 8);", false)); ASSERT_EQUALS("p = buf + 8 ;", tokenizeAndStringify("p = (buf + 8);", false));
} }
void removeParantheses11()
{
// #2502
ASSERT_EQUALS("{ } x ( ) ;", tokenizeAndStringify("{}(x());", false));
}
void tokenize_double() void tokenize_double()
{ {
const char code[] = "void f()\n" const char code[] = "void f()\n"