Fixed #4234 (segmentation fault of cppcheck in Tokenizer::simplifyFlowControl() (invalid code))
This commit is contained in:
parent
c2b61030a8
commit
e3bbcf501f
|
@ -2400,7 +2400,7 @@ void Tokenizer::simplifyLabelsCaseDefault()
|
|||
|
||||
if (Token::Match(tok, "[;{}] case")) {
|
||||
while (NULL != (tok = tok->next())) {
|
||||
if (tok->str() == ":")
|
||||
if (Token::Match(tok,"[:{};]"))
|
||||
break;
|
||||
}
|
||||
if (!tok)
|
||||
|
|
|
@ -5716,6 +5716,9 @@ private:
|
|||
//ticket #3227
|
||||
ASSERT_EQUALS("void foo ( ) { switch ( n ) { label : ; case 1 : ; label1 : ; label2 : ; break ; } }",
|
||||
tokenizeAndStringify("void foo(){ switch (n){ label: case 1: label1: label2: break; }}"));
|
||||
//ticket #4234
|
||||
ASSERT_EQUALS("( ) { switch break ; { switch ( x ) { case } y break ; : } }",
|
||||
tokenizeAndStringify("( ) { switch break ; { switch ( x ) { case } y break ; : } }"));
|
||||
}
|
||||
|
||||
void simplifyPointerToStandardType() {
|
||||
|
|
Loading…
Reference in New Issue