Fixed #2010 (missing continue in switch check ?)

This commit is contained in:
Daniel Marjamäki 2010-09-04 14:24:45 +02:00
parent 75fb99cee7
commit a2b4e5641f
2 changed files with 17 additions and 1 deletions

View File

@ -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.:

View File

@ -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"