Fixed #2616 (Segmentation fault with unknown macro)
This commit is contained in:
parent
a2d2d93958
commit
db04d7b71e
|
@ -4600,9 +4600,6 @@ void Tokenizer::simplifyIfAddBraces()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (tok->previous() && !Token::Match(tok->previous(), ";|{|}|else|)|:"))
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok, "if|for|while ("))
|
||||
{
|
||||
// don't add "{}" around ";" in "do {} while();" (#609)
|
||||
|
|
|
@ -80,6 +80,7 @@ private:
|
|||
TEST_CASE(ifAddBraces12);
|
||||
TEST_CASE(ifAddBraces13);
|
||||
TEST_CASE(ifAddBraces14); // #2610 - segfault: if()<{}
|
||||
TEST_CASE(ifAddBraces15); // #2616 - unknown macro before if
|
||||
|
||||
TEST_CASE(whileAddBraces);
|
||||
TEST_CASE(doWhileAddBraces);
|
||||
|
@ -861,6 +862,12 @@ private:
|
|||
tokenizeAndStringify("if()<{}", false);
|
||||
}
|
||||
|
||||
void ifAddBraces15()
|
||||
{
|
||||
// ticket #2616 - unknown macro before if
|
||||
ASSERT_EQUALS("{ A if ( x ) { y ( ) ; } }", tokenizeAndStringify("{A if(x)y();}", false));
|
||||
}
|
||||
|
||||
|
||||
void whileAddBraces()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue