Skip to content

Commit

Permalink
Fix parsing linkage specifier from global function declaration
Browse files Browse the repository at this point in the history
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).
thomasjfox committed Jan 8, 2015
1 parent 9657754 commit 374af15
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 374af15

Please sign in to comment.