Tokenizer::simplifyGoto: Don't simplify 'goto' inside unhandled macro calls. Ticket: #2348
This commit is contained in:
parent
472ecd8805
commit
18fd12006a
|
@ -6775,6 +6775,11 @@ void Tokenizer::simplifyGoto()
|
|||
}
|
||||
}
|
||||
|
||||
else if (indentlevel > 0 && tok->str() == "(")
|
||||
{
|
||||
tok = tok->link();
|
||||
}
|
||||
|
||||
else if (indentlevel == 0 && Token::Match(tok, ") const| {"))
|
||||
{
|
||||
gotos.clear();
|
||||
|
|
|
@ -147,6 +147,7 @@ private:
|
|||
|
||||
// Simplify goto..
|
||||
TEST_CASE(goto1);
|
||||
TEST_CASE(goto2);
|
||||
|
||||
// Simplify nested strcat() calls
|
||||
TEST_CASE(strcat1);
|
||||
|
@ -2778,6 +2779,12 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void goto2()
|
||||
{
|
||||
// Don't simplify goto inside function call (macro)
|
||||
const char code[] = "void f ( ) { slist_iter ( if ( a ) { goto dont_write ; } dont_write : ; x ( ) ; ) ; }";
|
||||
ASSERT_EQUALS(code, tok(code));
|
||||
}
|
||||
|
||||
void strcat1()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue