Fix parsing linkage specifier from global function declaration

Our very own "tools/dmake.cpp" had a function declaration
featuring "static void foobar()" while the function implementation
did not have the 'static' keyword (which is perfectly legal code).
This commit is contained in:
Thomas Jarosch 2015-01-09 00:34:48 +01:00
parent 965775423b
commit 374af15bd4
1 changed files with 7 additions and 1 deletions

View File

@ -1619,8 +1619,14 @@ Function* SymbolDatabase::addGlobalFunctionDecl(Scope*& scope, const Token *tok,
tok1 = tok1->previous();
// find the return type
while (tok1 && Token::Match(tok1, "static|extern|const"))
while (tok1 && Token::Match(tok1, "static|extern|const")) {
if (tok1->str() == "static")
function.isStaticLocal(true);
else if (tok1->str() == "extern")
function.isExtern(true);
tok1 = tok1->next();
}
if (tok1)
function.retDef = tok1;