From ad0d23036cf3e79e5b63eb5aea9736ae86627e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 14 Nov 2015 18:43:07 +0100 Subject: [PATCH] Fixed some cppcheck warnings about methods that can be static/const --- lib/checkautovariables.cpp | 2 +- lib/checkautovariables.h | 2 +- lib/checkobsolescentfunctions.h | 2 +- lib/symboldatabase.cpp | 2 +- lib/symboldatabase.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index e652b439e..a0208dc95 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -317,7 +317,7 @@ void CheckAutoVariables::errorUselessAssignmentPtrArg(const Token *tok) //--------------------------------------------------------------------------- // return temporary? -bool CheckAutoVariables::returnTemporary(const Token *tok) const +bool CheckAutoVariables::returnTemporary(const Token *tok) { bool func = false; // Might it be a function call? bool retref = false; // is there such a function that returns a reference? diff --git a/lib/checkautovariables.h b/lib/checkautovariables.h index f9aaab535..c3f539e9b 100644 --- a/lib/checkautovariables.h +++ b/lib/checkautovariables.h @@ -79,7 +79,7 @@ private: * @param tok pointing at the "return" token * @return true if a temporary object is returned */ - bool returnTemporary(const Token *tok) const; + static bool returnTemporary(const Token *tok); void errorReturnAddressToAutoVariable(const Token *tok); void errorReturnPointerToLocalArray(const Token *tok); diff --git a/lib/checkobsolescentfunctions.h b/lib/checkobsolescentfunctions.h index a46085334..9046cb4a6 100644 --- a/lib/checkobsolescentfunctions.h +++ b/lib/checkobsolescentfunctions.h @@ -62,7 +62,7 @@ private: static std::map _obsoleteC99Functions; /** init obsolete functions list ' */ - void initObsoleteFunctions() { + static void initObsoleteFunctions() { // Obsolete posix functions, which messages suggest only one alternative and doesn't contain additional information. const struct { const char* bad; diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 472deab66..422c28e96 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1301,7 +1301,7 @@ SymbolDatabase::~SymbolDatabase() } } -bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart) +bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart) const { if (tok->varId()) return false; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index a524304e8..0d51ede0a 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1019,7 +1019,7 @@ private: Function *addGlobalFunctionDecl(Scope*& scope, const Token* tok, const Token *argStart, const Token* funcStart); Function *addGlobalFunction(Scope*& scope, const Token*& tok, const Token *argStart, const Token* funcStart); void addNewFunction(Scope **info, const Token **tok); - bool isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart); + bool isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart) const; const Type *findTypeInNested(const Token *tok, const Scope *startScope) const; const Scope *findNamespace(const Token * tok, const Scope * scope) const; Function *findFunctionInScope(const Token *func, const Scope *ns);