Fixed #3238 (Crash in obsolete functions check.)
This commit is contained in:
parent
ccf087d2ea
commit
2b54f00c87
|
@ -47,7 +47,7 @@ void CheckObsoleteFunctions::obsoleteFunctions()
|
|||
if (tok->isName() && tok->varId()==0 && (tok->next() && tok->next()->str() == "(") &&
|
||||
(!Token::Match(tok->previous(), ".|::|:|,") || Token::simpleMatch(tok->previous()->previous(), "std :: gets"))) {
|
||||
// c function declaration?
|
||||
if ((tok->next()->link()->next() && tok->next()->link()->next()->str() == ";") && (tok->previous()->str() == "*" || tok->previous()->isName())) {
|
||||
if ((tok->next()->link()->next() && tok->next()->link()->next()->str() == ";") && (tok->previous() && (tok->previous()->str() == "*" || tok->previous()->isName()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ private:
|
|||
// function with body
|
||||
TEST_CASE(test_function_with_body);
|
||||
|
||||
// null pointer dereference in obsoleteFunctions
|
||||
TEST_CASE(ticket3238);
|
||||
}
|
||||
|
||||
void check(const char code[]) {
|
||||
|
@ -288,6 +290,10 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void ticket3238() {
|
||||
check("__FBSDID(\"...\");\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue