From 7a324cef25396b2615d3709ecea453c0b777078b Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Tue, 30 Jul 2013 12:52:27 +0200 Subject: [PATCH] Fixed various Cppcheck inconclusive warnings --- lib/checkmemoryleak.cpp | 2 +- lib/checkmemoryleak.h | 2 +- lib/checknullpointer.h | 2 +- lib/checkuninitvar.cpp | 4 ++-- lib/checkuninitvar.h | 2 +- lib/checkunusedfunctions.h | 6 +++--- lib/library.h | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 6499691ad..af0ce3bb4 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -209,7 +209,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, } -CheckMemoryLeak::AllocType CheckMemoryLeak::getReallocationType(const Token *tok2, unsigned int varid) const +CheckMemoryLeak::AllocType CheckMemoryLeak::getReallocationType(const Token *tok2, unsigned int varid) { // What we may have... // * var = (char *)realloc(..; diff --git a/lib/checkmemoryleak.h b/lib/checkmemoryleak.h index 525ff2400..dfcfaeaed 100644 --- a/lib/checkmemoryleak.h +++ b/lib/checkmemoryleak.h @@ -121,7 +121,7 @@ public: /** * @brief Get type of reallocation at given position */ - AllocType getReallocationType(const Token *tok2, unsigned int varid) const; + static AllocType getReallocationType(const Token *tok2, unsigned int varid); /** * @brief Is a typename the name of a class? diff --git a/lib/checknullpointer.h b/lib/checknullpointer.h index ae71a882d..2ecb7454d 100644 --- a/lib/checknullpointer.h +++ b/lib/checknullpointer.h @@ -157,7 +157,7 @@ private: /** * @brief Removes any variable that may be assigned from pointerArgs. */ - void removeAssignedVarFromSet(const Token* tok, std::set& pointerArgs); + static void removeAssignedVarFromSet(const Token* tok, std::set& pointerArgs); /** * @brief Investigate if function call can make pointer null. If diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index a5f64c3f2..dc6e2d34b 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -363,7 +363,7 @@ private: * @param tok2 start token of rhs * @param checks the execution paths */ - void parserhs(const Token *tok2, std::list &checks) const { + static void parserhs(const Token *tok2, std::list &checks) { // check variable usages in rhs/index while (NULL != (tok2 = tok2->next())) { if (Token::Match(tok2, "[;)=]")) @@ -1690,7 +1690,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, bool cpp return false; } -bool CheckUninitVar::isMemberVariableAssignment(const Token *tok, const std::string &membervar) const +bool CheckUninitVar::isMemberVariableAssignment(const Token *tok, const std::string &membervar) { if (Token::Match(tok, "%var% . %var%") && tok->strAt(2) == membervar) { if (Token::Match(tok->tokAt(3), "[=.[]")) diff --git a/lib/checkuninitvar.h b/lib/checkuninitvar.h index 03899b9a6..9cdb5fa83 100644 --- a/lib/checkuninitvar.h +++ b/lib/checkuninitvar.h @@ -62,7 +62,7 @@ public: bool checkLoopBody(const Token *tok, const Variable& var, const std::string &membervar, const bool suppressErrors); void checkRhs(const Token *tok, const Variable &var, const std::string &membervar); static bool isVariableUsage(const Token *vartok, bool ispointer, bool cpp); - bool isMemberVariableAssignment(const Token *tok, const std::string &membervar) const; + static bool isMemberVariableAssignment(const Token *tok, const std::string &membervar); bool isMemberVariableUsage(const Token *tok, bool isPointer, const std::string &membervar) const; /** diff --git a/lib/checkunusedfunctions.h b/lib/checkunusedfunctions.h index 2c087abd8..1f10c1e08 100644 --- a/lib/checkunusedfunctions.h +++ b/lib/checkunusedfunctions.h @@ -58,9 +58,9 @@ private: /** * Dummy implementation, just to provide error for --errorlist */ - void unusedFunctionError(ErrorLogger * const errorLogger, - const std::string &filename, unsigned int lineNumber, - const std::string &funcname); + static void unusedFunctionError(ErrorLogger * const errorLogger, + const std::string &filename, unsigned int lineNumber, + const std::string &funcname); /** * Dummy implementation, just to provide error for --errorlist diff --git a/lib/library.h b/lib/library.h index 68ed7ab68..09c7a814c 100644 --- a/lib/library.h +++ b/lib/library.h @@ -133,7 +133,7 @@ private: return NULL; } - int getid(const std::map &data, const std::string &name) const { + static int getid(const std::map &data, const std::string &name) { const std::map::const_iterator it = data.find(name); return (it == data.end()) ? 0 : it->second; }