File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2820,6 +2820,14 @@ class TestCondition : public TestFixture {
28202820 " }\n "
28212821 " }" );
28222822 ASSERT_EQUALS (" " , errout_str ());
2823+
2824+ check (" void f(const int* p, const int* e) {\n " // #14595
2825+ " for (; p;) {\n "
2826+ " if (p == e) {}\n "
2827+ " if (p) {}\n "
2828+ " }\n "
2829+ " }\n " );
2830+ ASSERT_EQUALS (" [test.cpp:2:12] -> [test.cpp:4:13]: (warning) Identical inner 'if' condition is always true. [identicalInnerCondition]\n " , errout_str ());
28232831 }
28242832
28252833 void identicalConditionAfterEarlyExit () {
@@ -4675,7 +4683,7 @@ class TestCondition : public TestFixture {
46754683 " }\n "
46764684 " }\n "
46774685 " }\n " );
4678- ASSERT_EQUALS (" [test.cpp:5:18]: (style) Condition 'S::s' is always true [knownConditionTrueFalse ]\n " , errout_str ());
4686+ ASSERT_EQUALS (" [test.cpp:3:10] -> [test.cpp: 5:18]: (warning) Identical inner 'if' condition is always true. [identicalInnerCondition ]\n " , errout_str ());
46794687
46804688 check (" void f() {\n " // #10811
46814689 " int i = 0;\n "
@@ -4836,7 +4844,7 @@ class TestCondition : public TestFixture {
48364844 " if (!b) {}\n "
48374845 " if (a) {}\n "
48384846 " }\n " );
4839- ASSERT_EQUALS (" [test.cpp:6:9] -> [test.cpp:9:9]: (style) Condition 'a' is always false [knownConditionTrueFalse ]\n " ,
4847+ ASSERT_EQUALS (" [test.cpp:6:9] -> [test.cpp:9:9]: (warning) Identical condition 'a', second condition is always false [identicalConditionAfterEarlyExit ]\n " ,
48404848 errout_str ());
48414849 }
48424850
You can’t perform that action at this time.
0 commit comments