Merge branch 'master' of git@github.com:danmar/cppcheck

This commit is contained in:
Daniel Marjamäki 2010-01-20 21:19:32 +01:00
commit 3447030564
2 changed files with 2 additions and 1 deletions

View File

@ -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))));

View File

@ -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];"));
}