Fixed #3573 (Preprocessor: handle '!(X)' the same as '!X')
This commit is contained in:
parent
81caeb0232
commit
c07044b3d3
|
@ -6701,6 +6701,13 @@ bool Tokenizer::simplifyRedundantParenthesis()
|
|||
ret = true;
|
||||
}
|
||||
|
||||
if (Token::Match(tok->previous(), "! ( %var% )")) {
|
||||
// Remove the parenthesis
|
||||
tok->deleteThis();
|
||||
tok->deleteNext();
|
||||
ret = true;
|
||||
}
|
||||
|
||||
while (Token::Match(tok->previous(), "[,;{}(] ( %var% (") &&
|
||||
tok->link()->previous() == tok->linkAt(2)) {
|
||||
// We have "( func ( *something* ))", remove the outer
|
||||
|
|
|
@ -124,6 +124,7 @@ private:
|
|||
TEST_CASE(if_cond11);
|
||||
TEST_CASE(if_cond12);
|
||||
TEST_CASE(if_cond13);
|
||||
TEST_CASE(if_cond14);
|
||||
|
||||
TEST_CASE(if_or_1);
|
||||
TEST_CASE(if_or_2);
|
||||
|
@ -1464,6 +1465,14 @@ private:
|
|||
ASSERT_EQUALS("\n123\n\n", preprocessor.getcode(filedata,"",""));
|
||||
}
|
||||
|
||||
void if_cond14() {
|
||||
const char filedata[] = "#if !(A)\n"
|
||||
"123\n"
|
||||
"#endif\n";
|
||||
Preprocessor preprocessor(NULL, this);
|
||||
ASSERT_EQUALS("\n123\n\n", preprocessor.getcode(filedata,"",""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void if_or_1() {
|
||||
|
|
Loading…
Reference in New Issue