Fixed valgrind error in #3953 , but there's still the bad enum problem.
This commit is contained in:
parent
de8e592d00
commit
406483b618
|
@ -844,9 +844,12 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens)
|
|||
tok->deleteNext();
|
||||
tok->deleteThis();
|
||||
ret = true;
|
||||
} else if (Token::Match(tok->previous(), "[=[(,] 0 * %any% ,|]|)|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "return|case 0 * %any% ,|:|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "return|case 0 && %any% ,|:|;|=|%op%")) {
|
||||
} else if (Token::Match(tok->previous(), "[=[(,] 0 * %var% ,|]|)|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "[=[(,] 0 * %num% ,|]|)|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "[=[(,] 0 * ( ,|]|)|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "return|case 0 *|&& %var% ,|:|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "return|case 0 *|&& %num% ,|:|;|=|%op%") ||
|
||||
Token::Match(tok->previous(), "return|case 0 *|&& ( ,|:|;|=|%op%")) {
|
||||
tok->deleteNext();
|
||||
if (tok->next()->str() == "(")
|
||||
Token::eraseTokens(tok, tok->next()->link());
|
||||
|
|
|
@ -6638,6 +6638,9 @@ private:
|
|||
|
||||
// ticket #3964 - simplify numeric calculations in tokenization
|
||||
ASSERT_EQUALS("char a [ 10 ] ;", tokenizeAndStringify("char a[9+1];"));
|
||||
|
||||
// #3953 (valgrind errors on garbage code)
|
||||
ASSERT_EQUALS("void f ( 0 * ) ;", tokenizeAndStringify("void f ( 0 * ) ;"));
|
||||
}
|
||||
|
||||
void simplifyCompoundAssignment() {
|
||||
|
|
Loading…
Reference in New Issue