From a2b4e5641fba9774fc603eec5c8cc3887971dbbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 4 Sep 2010 14:24:45 +0200 Subject: [PATCH] Fixed #2010 (missing continue in switch check ?) --- lib/checkother.cpp | 2 +- test/testother.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 9f04e2058..bd0cc2c20 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -278,7 +278,7 @@ void CheckOther::checkFflushOnInputStream() void CheckOther::checkRedundantAssignmentInSwitch() { const char switchPattern[] = "switch ( %any% ) { case"; - const char breakPattern[] = "break|return|exit|goto"; + const char breakPattern[] = "break|continue|return|exit|goto"; const char functionPattern[] = "%var% ("; // Find the beginning of a switch. E.g.: diff --git a/test/testother.cpp b/test/testother.cpp index 49518cfa2..2fbf0a018 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -3023,6 +3023,22 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + check("void foo()\n" + "{\n" + " int y = 1;\n" + " while(xyz()) {\n" + " switch (x)\n" + " {\n" + " case 2:\n" + " y = 2;\n" + " continue;\n" + " case 3:\n" + " y = 3;\n" + " }\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + check("void foo()\n" "{\n" " int y = 1;\n"