@@ -308,7 +308,7 @@ class TestBool : public TestFixture {
308308 " a++;\n "
309309 " }\n "
310310 );
311- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer other than 0 or 1 .\n " , errout.str ());
311+ ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer.\n " , errout.str ());
312312
313313 check (" void f(int x) {\n "
314314 " if ((5 && x) < 1)\n "
@@ -322,7 +322,7 @@ class TestBool : public TestFixture {
322322 " a++;\n "
323323 " }\n "
324324 );
325- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer other than 0 or 1 .\n " , errout.str ());
325+ ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer.\n " , errout.str ());
326326
327327
328328 check (" void f(int x) {\n "
@@ -337,7 +337,7 @@ class TestBool : public TestFixture {
337337 " a++;\n "
338338 " }\n "
339339 );
340- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer other than 0 or 1 .\n " , errout.str ());
340+ ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer.\n " , errout.str ());
341341
342342 check (" void f(int x) {\n "
343343 " if (1 > (5 && x))\n "
@@ -351,7 +351,7 @@ class TestBool : public TestFixture {
351351 " a++;\n "
352352 " }\n "
353353 );
354- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer other than 0 or 1 .\n " , errout.str ());
354+ ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer.\n " , errout.str ());
355355
356356 check (" void f(bool x ) {\n "
357357 " if ( x > false )\n "
@@ -422,16 +422,6 @@ class TestBool : public TestFixture {
422422 check (" int f() { return (!a+b<c); }" );
423423 ASSERT_EQUALS (" " ,errout.str ());
424424
425- {
426- const char code[] = " void f(int x, bool y) { if ( x != y ) {} }" ;
427-
428- check (code, false , " test.cpp" );
429- ASSERT_EQUALS (" [test.cpp:1]: (warning) Comparison of a boolean expression with an integer.\n " , errout.str ());
430-
431- check (code, false , " test.c" );
432- ASSERT_EQUALS (" " , errout.str ());
433- }
434-
435425 check (" int f() { return (a+(b<5)<=c); }" );
436426 ASSERT_EQUALS (" " ,errout.str ());
437427 }
@@ -513,7 +503,7 @@ class TestBool : public TestFixture {
513503 ASSERT_EQUALS (" " ,errout.str ());
514504
515505 check (" void f(int a, int b, int c) { if (1 < !(a+b)) {} }" );
516- ASSERT_EQUALS (" [test.cpp:1]: (warning) Comparison of a boolean expression with an integer other than 0 or 1 .\n " ,errout.str ());
506+ ASSERT_EQUALS (" [test.cpp:1]: (warning) Comparison of a boolean expression with an integer.\n " ,errout.str ());
517507 }
518508
519509 void comparisonOfBoolExpressionWithInt3 () {
@@ -533,7 +523,7 @@ class TestBool : public TestFixture {
533523 check (" void f(int a, int b, int c) {\n "
534524 " return (a > b) < c;\n "
535525 " }" );
536- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
526+ ASSERT_EQUALS (" " , errout.str ());
537527
538528 check (" void f(int a, int b, int c) {\n "
539529 " return x(a > b) < c;\n "
@@ -629,14 +619,8 @@ class TestBool : public TestFixture {
629619 " printf(\" foo\" );\n "
630620 " }\n "
631621 " }\n "
632- " bool compare(int temp){\n "
633- " if(temp==4){\n "
634- " return true;\n "
635- " }\n "
636- " else\n "
637- " return false;\n "
638- " }" );
639- ASSERT_EQUALS (" [test.cpp:3]: (warning) Comparison of a boolean expression with an integer.\n "
622+ " bool compare(int temp);" );
623+ ASSERT_EQUALS (" [test.cpp:3]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.\n "
640624 " [test.cpp:3]: (style) Comparison of a function returning boolean value using relational (<, >, <= or >=) operator.\n " , errout.str ());
641625 }
642626
@@ -950,14 +934,14 @@ class TestBool : public TestFixture {
950934 " printf(\" foo\" );\n "
951935 " }\n "
952936 " }" );
953- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
937+ ASSERT_EQUALS (" " , errout.str ());
954938
955939 check (" void f(int x, bool y) {\n "
956940 " if (x == y) {\n "
957941 " printf(\" foo\" );\n "
958942 " }\n "
959943 " }" );
960- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
944+ ASSERT_EQUALS (" " , errout.str ());
961945
962946 check (" void f(bool x, bool y) {\n "
963947 " if (x == y) {\n "
@@ -980,15 +964,14 @@ class TestBool : public TestFixture {
980964 " printf(\" foo\" );\n "
981965 " }\n "
982966 " }" );
983- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer.\n "
984- " [test.cpp:2]: (warning) Comparison of a boolean value using relational operator (<, >, <= or >=).\n " , errout.str ());
967+ ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean value using relational operator (<, >, <= or >=).\n " , errout.str ());
985968
986969 check (" void f(int y) {\n "
987970 " if (true == y) {\n "
988971 " printf(\" foo\" );\n "
989972 " }\n "
990973 " }" );
991- ASSERT_EQUALS (" [test.cpp:2]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
974+ ASSERT_EQUALS (" " , errout.str ());
992975
993976 check (" void f(bool y) {\n "
994977 " if (y == true) {\n "
@@ -1049,15 +1032,15 @@ class TestBool : public TestFixture {
10491032 " if (expectedResult == res)\n "
10501033 " throw 2;\n "
10511034 " }" );
1052- ASSERT_EQUALS (" [test.cpp:4]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
1035+ ASSERT_EQUALS (" " , errout.str ());
10531036
10541037 check (" bool Fun();\n "
10551038 " void Test(bool expectedResult) {\n "
10561039 " auto res = Fun();\n "
10571040 " if (5 + expectedResult == res)\n "
10581041 " throw 2;\n "
10591042 " }" );
1060- ASSERT_EQUALS (" [test.cpp:4]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
1043+ ASSERT_EQUALS (" " , errout.str ());
10611044
10621045 check (" int Fun();\n "
10631046 " void Test(bool expectedResult) {\n "
@@ -1073,7 +1056,7 @@ class TestBool : public TestFixture {
10731056 " if (expectedResult == res + 5)\n "
10741057 " throw 2;\n "
10751058 " }" );
1076- ASSERT_EQUALS ( " [test.cpp:4]: (warning) Comparison of a boolean expression with an integer. \n " , errout.str ());
1059+ TODO_ASSERT_EQUALS ( " error " , " " , errout.str ());
10771060 }
10781061
10791062 void comparisonOfBoolWithInt9 () { // #9304
0 commit comments