@@ -3373,8 +3373,8 @@ class TestCondition : public TestFixture {
33733373
33743374 check (" void f() {\n "
33753375 " int x = 0;\n "
3376- " if (x++ == 1) {}\n "
3377- " if (x++ == 2) {}\n "
3376+ " if (x++ == 1) {}\n " // <- no warning as there is a side effect
3377+ " if (x++ == 2) {}\n " // <- no warning as there is a side effect
33783378 " }\n " );
33793379 ASSERT_EQUALS (" " , errout_str ());
33803380
@@ -4510,7 +4510,7 @@ class TestCondition : public TestFixture {
45104510 " void foo() {\n "
45114511 " if (bar(1) == 0 && bar(1) > 0) {}\n "
45124512 " }\n " );
4513- // TODO the isConstExpression returns true for the bar() function call
4513+ // TODO the isConstExpression returns false for the bar() function call
45144514 // these warnings are shown if the isConstExpression is removed from the checker
45154515 TODO_ASSERT_EQUALS (" [test.cpp:3:16]: (style) Condition 'bar(1)==0' is always false [knownConditionTrueFalse]\n "
45164516 " [test.cpp:3:31]: (style) Condition 'bar(1)>0' is always true [knownConditionTrueFalse]\n " ,
@@ -4590,7 +4590,7 @@ class TestCondition : public TestFixture {
45904590 " void f() {\n "
45914591 " if (g() == 1 && g() == -1) {}\n "
45924592 " }\n " );
4593- // TODO the isConstExpression returns true for the bar() function call
4593+ // TODO the isConstExpression returns false for the bar() function call
45944594 // these warnings are shown if the isConstExpression is removed from the checker
45954595 TODO_ASSERT_EQUALS (" [test.cpp:3:13]: (style) Condition 'g()==1' is always false [knownConditionTrueFalse]\n "
45964596 " [test.cpp:3:25]: (style) Condition 'g()==-1' is always true [knownConditionTrueFalse]\n " ,
@@ -6485,7 +6485,7 @@ class TestCondition : public TestFixture {
64856485 ASSERT_EQUALS (" " , errout_str ());
64866486
64876487 // the assignments are always false/true.. but "assignment in condition" would be a different checker
6488- // knownConditionTrueFalse only warns about const code that can be removed.
6488+ // knownConditionTrueFalse should only warn if code can be removed.
64896489 check (" void f(uint32_t u) {\n " // #2490
64906490 " if ((u = 0x00000000) || (u = 0xffffffff)) {}\n "
64916491 " }\n " );
0 commit comments