Fixed segfault
This commit is contained in:
parent
aea528c763
commit
d144197d7e
|
@ -2197,7 +2197,7 @@ void CheckOther::checkIncompleteStatement()
|
||||||
// no warning if this is the last statement in a ({})
|
// no warning if this is the last statement in a ({})
|
||||||
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||||
if (tok2->str() == "(")
|
if (tok2->str() == "(")
|
||||||
tok2 = tok->link();
|
tok2 = tok2->link();
|
||||||
else if (Token::Match(tok2, "[;{}]")) {
|
else if (Token::Match(tok2, "[;{}]")) {
|
||||||
bailout = Token::simpleMatch(tok2, "; } )");
|
bailout = Token::simpleMatch(tok2, "; } )");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -59,6 +59,7 @@ private:
|
||||||
TEST_CASE(test3);
|
TEST_CASE(test3);
|
||||||
TEST_CASE(test4);
|
TEST_CASE(test4);
|
||||||
TEST_CASE(test5);
|
TEST_CASE(test5);
|
||||||
|
TEST_CASE(test6);
|
||||||
TEST_CASE(test_numeric);
|
TEST_CASE(test_numeric);
|
||||||
TEST_CASE(intarray);
|
TEST_CASE(intarray);
|
||||||
TEST_CASE(structarraynull);
|
TEST_CASE(structarraynull);
|
||||||
|
@ -123,6 +124,15 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Redundant code: Found a statement that begins with numeric constant.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Redundant code: Found a statement that begins with numeric constant.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test6() {
|
||||||
|
// dont crash
|
||||||
|
check("void f() {\n"
|
||||||
|
" 1 == (two + three);\n"
|
||||||
|
" 2 != (two + three);\n"
|
||||||
|
" (one + two) != (two + three);\n"
|
||||||
|
"}");
|
||||||
|
}
|
||||||
|
|
||||||
void test_numeric() {
|
void test_numeric() {
|
||||||
check("struct P\n"
|
check("struct P\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue