Fixed #989 (CppCheck crashes on Win XP when scanning large directories/subdirectories)
This commit is contained in:
parent
7596e76a79
commit
128b2b8c59
|
@ -3635,7 +3635,7 @@ void Tokenizer::elseif()
|
||||||
|
|
||||||
if (indent == 0 && Token::Match(tok2, "}|;"))
|
if (indent == 0 && Token::Match(tok2, "}|;"))
|
||||||
{
|
{
|
||||||
if (tok2->next()->str() != "else")
|
if (tok2->next() && tok2->next()->str() != "else")
|
||||||
{
|
{
|
||||||
tok->insertToken("{");
|
tok->insertToken("{");
|
||||||
tok2->insertToken("}");
|
tok2->insertToken("}");
|
||||||
|
|
|
@ -530,6 +530,9 @@ private:
|
||||||
{
|
{
|
||||||
const char code[] = "else if(ab) { cd } else { ef }gh";
|
const char code[] = "else if(ab) { cd } else { ef }gh";
|
||||||
ASSERT_EQUALS("\n\n##file 0\n1: else { if ( ab ) { cd } else { ef } } gh\n", elseif(code));
|
ASSERT_EQUALS("\n\n##file 0\n1: else { if ( ab ) { cd } else { ef } } gh\n", elseif(code));
|
||||||
|
|
||||||
|
// syntax error: assert there is no segmentation fault
|
||||||
|
ASSERT_EQUALS("\n\n##file 0\n1: else if ( x ) { }\n", elseif("else if (x) { }"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue