@@ -1513,13 +1513,6 @@ class TestCondition : public TestFixture {
15131513 " }\n "
15141514 " }" );
15151515 ASSERT_EQUALS (" " , errout.str ());
1516-
1517- check (" void f(const int *i) {\n "
1518- " if (!i) return;\n "
1519- " if (!num1tok) { *num1 = *num2; }\n "
1520- " if (!i) {}\n "
1521- " }" );
1522- ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:4]: (warning) Same condition, second condition is always false\n " , errout.str ());
15231516 }
15241517
15251518 void oppositeInnerConditionClass () {
@@ -1761,21 +1754,34 @@ class TestCondition : public TestFixture {
17611754 " if (x > 100) { return; }\n "
17621755 " if (x > 100) {}\n "
17631756 " }" );
1764- ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:3]: (warning) Same condition, second condition is always false\n " , errout.str ());
1757+ ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:3]: (warning) Same condition 'x>100', second condition is always false\n " , errout.str ());
1758+
1759+ check (" void f(int x) {\n "
1760+ " if (x > 100) { return; }\n "
1761+ " if (x > 100 || y > 100) {}\n "
1762+ " }" );
1763+ ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:3]: (warning) Same condition 'x>100', second condition is always false\n " , errout.str ());
17651764
17661765 check (" void f(int x) {\n "
17671766 " if (x > 100) { return; }\n "
17681767 " if (abc) {}\n "
17691768 " if (x > 100) {}\n "
17701769 " }" );
1771- ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:4]: (warning) Same condition, second condition is always false\n " , errout.str ());
1770+ ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:4]: (warning) Same condition 'x>100' , second condition is always false\n " , errout.str ());
17721771
17731772 check (" void f(int x) {\n "
17741773 " if (x > 100) { return; }\n "
17751774 " while (abc) { y = x; }\n "
17761775 " if (x > 100) {}\n "
17771776 " }" );
1778- ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:4]: (warning) Same condition, second condition is always false\n " , errout.str ());
1777+ ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:4]: (warning) Same condition 'x>100', second condition is always false\n " , errout.str ());
1778+
1779+ check (" void f(const int *i) {\n "
1780+ " if (!i) return;\n "
1781+ " if (!num1tok) { *num1 = *num2; }\n "
1782+ " if (!i) {}\n "
1783+ " }" );
1784+ ASSERT_EQUALS (" [test.cpp:2] -> [test.cpp:4]: (warning) Same condition '!i', second condition is always false\n " , errout.str ());
17791785 }
17801786
17811787 // clarify conditions with = and comparison
0 commit comments