Fixed #5197 (SymbolDatabase: bad handling of unknown macros in function declaration)

This commit is contained in:
Robert Reif 2013-11-25 03:43:39 +01:00 committed by Daniel Marjamäki
parent 13cd0f41f6
commit 43f00942dd
2 changed files with 13 additions and 0 deletions

View File

@ -486,6 +486,13 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
scope->functionList.push_back(function);
}
// unknown macro (#5197)
else if (Token::Match(end, ") %any% ;")) {
tok = end->tokAt(3);
scope->functionList.push_back(function);
}
// inline function
else {
function.isInline = true;

View File

@ -202,6 +202,7 @@ private:
TEST_CASE(symboldatabase38); // ticket #5125 (infinite recursion)
TEST_CASE(symboldatabase39); // ticket #5120 (infinite recursion)
TEST_CASE(symboldatabase40); // ticket #5153
TEST_CASE(symboldatabase41); // ticket #5197 (unknown macro)
TEST_CASE(isImplicitlyVirtual);
@ -1666,6 +1667,11 @@ private:
ASSERT_EQUALS("", errout.str());
}
void symboldatabase41() { // ticket #5197 (unknown macro)
GET_SYMBOL_DB("struct X1 { MACRO1 f(int spd) MACRO2; };\n");
ASSERT(db && db->findScopeByName("X1") && db->findScopeByName("X1")->functionList.size() == 1 && !db->findScopeByName("X1")->functionList.front().hasBody);
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"