Fixed #2178 (segmentation fault of cppcheck)
This commit is contained in:
parent
6a4f70e496
commit
c2bf3647a4
|
@ -499,8 +499,20 @@ void CheckClass::createSymbolDatabase()
|
|||
|
||||
// not in SpaceInfo
|
||||
else
|
||||
{
|
||||
// found a "?" skip until the end of statement is found to avoid detecting
|
||||
// false functions..
|
||||
if (tok->str() == "?")
|
||||
{
|
||||
while (tok && !Token::Match(tok, "[;{}]"))
|
||||
tok = tok->next();
|
||||
if (!tok)
|
||||
break;
|
||||
}
|
||||
|
||||
addIfFunction(&info, &tok);
|
||||
}
|
||||
}
|
||||
|
||||
std::list<SpaceInfo *>::iterator it;
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ private:
|
|||
TEST_CASE(symboldatabase2);
|
||||
TEST_CASE(symboldatabase3); // ticket #2000
|
||||
TEST_CASE(symboldatabase4);
|
||||
TEST_CASE(symboldatabase5); // ticket #2178
|
||||
}
|
||||
|
||||
// Check the operator Equal
|
||||
|
@ -4796,6 +4797,15 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase5()
|
||||
{
|
||||
// ticket #2178 - segmentation fault
|
||||
checkConst("int CL_INLINE_DECL(integer_decode_float) (int x) {\n"
|
||||
" return (sign ? cl_I() : 0);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestClass)
|
||||
|
|
Loading…
Reference in New Issue