Fixed #965 (Division by zero false positive with nested macros)

This commit is contained in:
Daniel Marjamäki 2009-11-20 20:42:28 +01:00
parent 41b2a52915
commit 531d0fa685
2 changed files with 2 additions and 1 deletions

View File

@ -3714,7 +3714,7 @@ bool Tokenizer::simplifyCalculations()
continue; continue;
// + and - are calculated after * // + and - are calculated after *
if (Token::Match(tok->next(), "[+-]")) if (Token::Match(tok->next(), "[+-/]"))
{ {
if (tok->previous()->str() == "*") if (tok->previous()->str() == "*")
continue; continue;

View File

@ -1758,6 +1758,7 @@ private:
ASSERT_EQUALS("x = 1 + 2 * y ;", tok("x=1+2*y;")); ASSERT_EQUALS("x = 1 + 2 * y ;", tok("x=1+2*y;"));
ASSERT_EQUALS("x = 7 ;", tok("x=1+2*3;")); ASSERT_EQUALS("x = 7 ;", tok("x=1+2*3;"));
ASSERT_EQUALS("x = 47185 ;", tok("x=(65536*72/100);")); ASSERT_EQUALS("x = 47185 ;", tok("x=(65536*72/100);"));
ASSERT_EQUALS("x = 900 ;", tok("x = 1500000 / ((145000 - 55000) * 1000 / 54000);"));
} }