Fixed #2010 (missing continue in switch check ?)
This commit is contained in:
parent
75fb99cee7
commit
a2b4e5641f
|
@ -278,7 +278,7 @@ void CheckOther::checkFflushOnInputStream()
|
||||||
void CheckOther::checkRedundantAssignmentInSwitch()
|
void CheckOther::checkRedundantAssignmentInSwitch()
|
||||||
{
|
{
|
||||||
const char switchPattern[] = "switch ( %any% ) { case";
|
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% (";
|
const char functionPattern[] = "%var% (";
|
||||||
|
|
||||||
// Find the beginning of a switch. E.g.:
|
// Find the beginning of a switch. E.g.:
|
||||||
|
|
|
@ -3023,6 +3023,22 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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"
|
check("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" int y = 1;\n"
|
" int y = 1;\n"
|
||||||
|
|
Loading…
Reference in New Issue