Merge branch 'master' of git@github.com:danmar/cppcheck
This commit is contained in:
commit
3447030564
|
@ -4287,7 +4287,7 @@ bool Tokenizer::simplifyCalculations()
|
|||
if (Token::Match(tok->previous(), "- %num% - %num%"))
|
||||
tok->str(MathLib::calculate(tok->str(), tok->tokAt(2)->str(), '+'));
|
||||
else if (Token::Match(tok->previous(), "- %num% + %num%"))
|
||||
tok->str(MathLib::calculate(tok->tokAt(2)->str(), tok->str(), '-'));
|
||||
tok->str(MathLib::calculate(tok->str(), tok->tokAt(2)->str(), '-'));
|
||||
else
|
||||
tok->str(MathLib::calculate(tok->str(), tok->tokAt(2)->str(), *(tok->strAt(1))));
|
||||
|
||||
|
|
|
@ -1943,6 +1943,7 @@ private:
|
|||
ASSERT_EQUALS("x = 900 ;", tok("x = 1500000 / ((145000 - 55000) * 1000 / 54000);"));
|
||||
ASSERT_EQUALS("int a [ 8 ] ;", tok("int a[5+6/2];"));
|
||||
ASSERT_EQUALS("int a [ 4 ] ;", tok("int a[(10)-1-5];"));
|
||||
ASSERT_EQUALS("int a [ i - 9 ] ;", tok("int a[i - 10 + 1];"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue