From 374af15bd43531015b3a99b3371b1652acc5a21e Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Fri, 9 Jan 2015 00:34:48 +0100 Subject: [PATCH] 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). --- lib/symboldatabase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 39387d7f8..426a46d67 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -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;