From 79010eecea3f100670f820153aa35f16f1e25f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 3 Apr 2017 00:06:46 +0200 Subject: [PATCH] lib: fix a bunch of warnings about differing function arguments in definition and declaration. [lib/token.h:72] -> [lib/token.cpp:36]: (style, inconclusive) Function 'Token' argument 1 names different: declaration 'tokensBack' definition 't'. [lib/token.h:445] -> [lib/token.cpp:497]: (style, inconclusive) Function 'multiCompare' argument 1 names different: declaration 'needle' definition 'tok'. [lib/checkio.h:73] -> [lib/checkio.cpp:1385]: (style, inconclusive) Function 'ArgumentInfo' argument 3 names different: declaration 'isCPP' definition '_isCPP'. [lib/checkother.h:216] -> [lib/checkother.cpp:2136]: (style, inconclusive) Function 'checkComparisonFunctionIsAlwaysTrueOrFalseError' argument 2 names different: declaration 'strFunctionName' definition 'functionName'. [lib/errorlogger.h:214] -> [lib/errorlogger.cpp:51]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'. [lib/errorlogger.h:215] -> [lib/errorlogger.cpp:65]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'. [lib/library.h:327] -> [lib/library.cpp:1043]: (style, inconclusive) Function 'ignorefunction' argument 1 names different: declaration 'function' definition 'functionName'. [lib/mathlib.h:112] -> [lib/mathlib.cpp:1275]: (style, inconclusive) Function 'isNullValue' argument 1 names different: declaration 'tok' definition 'str'. [lib/preprocessor.h:91] -> [lib/preprocessor.cpp:122]: (style, inconclusive) Function 'setDirectives' argument 1 names different: declaration 'tokens' definition 'tokens1'. [lib/symboldatabase.h:860] -> [lib/symboldatabase.cpp:1801]: (style, inconclusive) Function 'argsMatch' argument 1 names different: declaration 'info' definition 'scope'. [lib/symboldatabase.h:1171] -> [lib/symboldatabase.cpp:2048]: (style, inconclusive) Function 'addClassFunction' argument 1 names different: declaration 'info' definition 'scope'. [lib/symboldatabase.h:1174] -> [lib/symboldatabase.cpp:2208]: (style, inconclusive) Function 'addNewFunction' argument 1 names different: declaration 'info' definition 'scope'. [lib/symboldatabase.h:1090] -> [lib/symboldatabase.cpp:3648]: (style, inconclusive) Function 'findVariableType' argument 2 names different: declaration 'type' definition 'typeTok'. [lib/symboldatabase.h:1101] -> [lib/symboldatabase.cpp:4308]: (style, inconclusive) Function 'findType' argument 1 names different: declaration 'tok' definition 'startTok'. [lib/symboldatabase.h:1176] -> [lib/symboldatabase.cpp:4349]: (style, inconclusive) Function 'findTypeInNested' argument 1 names different: declaration 'tok' definition 'startTok'. [lib/symboldatabase.h:1193] -> [lib/symboldatabase.cpp:4501]: (style, inconclusive) Function 'setValueType' argument 2 names different: declaration 'enumerators' definition 'enumerator'. [lib/path.h:159] -> [lib/path.cpp:247]: (style, inconclusive) Function 'isCPP' argument 1 names different: declaration 'extensionInLowerCase' definition 'path'. [lib/path.h:145] -> [lib/path.cpp:266]: (style, inconclusive) Function 'acceptFile' argument 1 names different: declaration 'filename' definition 'path'. --- lib/checkio.h | 2 +- lib/checkother.h | 2 +- lib/errorlogger.cpp | 8 ++++---- lib/errorlogger.h | 4 ++-- lib/library.h | 2 +- lib/mathlib.h | 2 +- lib/path.h | 4 ++-- lib/preprocessor.cpp | 4 ++-- lib/symboldatabase.h | 14 +++++++------- lib/token.cpp | 4 ++-- lib/token.h | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/checkio.h b/lib/checkio.h index 798d3a9c9..81dd1a874 100644 --- a/lib/checkio.h +++ b/lib/checkio.h @@ -70,7 +70,7 @@ public: private: class ArgumentInfo { public: - ArgumentInfo(const Token *arg, const Settings *settings, bool isCPP); + ArgumentInfo(const Token *arg, const Settings *settings, bool _isCPP); ~ArgumentInfo(); bool isArrayOrPointer() const; diff --git a/lib/checkother.h b/lib/checkother.h index 39d8c5548..3d34e9798 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -213,7 +213,7 @@ public: private: // Error messages.. - void checkComparisonFunctionIsAlwaysTrueOrFalseError(const Token* tok, const std::string &strFunctionName, const std::string &varName, const bool result); + void checkComparisonFunctionIsAlwaysTrueOrFalseError(const Token* tok, const std::string &functionName, const std::string &varName, const bool result); void checkCastIntToCharAndBackError(const Token *tok, const std::string &strFunctionName); void checkPipeParameterSizeError(const Token *tok, const std::string &strVarName, const std::string &strDim); void clarifyCalculationError(const Token *tok, const std::string &op); diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index d1f1c9676..a785d028d 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -48,10 +48,10 @@ ErrorLogger::ErrorMessage::ErrorMessage() { } -ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack, const std::string& file0_, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive) : +ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack, const std::string& file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive) : _callStack(callStack), // locations for this error message _id(id), // set the message id - file0(file0_), + file0(file1), _severity(severity), // severity for this error message _cwe(0U), _inconclusive(inconclusive) @@ -62,10 +62,10 @@ ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack -ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack, const std::string& file0_, Severity::SeverityType severity, const std::string &msg, const std::string &id, const CWE &cwe, bool inconclusive) : +ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack, const std::string& file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, const CWE &cwe, bool inconclusive) : _callStack(callStack), // locations for this error message _id(id), // set the message id - file0(file0_), + file0(file1), _severity(severity), // severity for this error message _cwe(cwe.id), _inconclusive(inconclusive) diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 9c9a21c60..e4f8d07fb 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -211,8 +211,8 @@ public: std::string _file; }; - ErrorMessage(const std::list &callStack, const std::string& file0, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive); - ErrorMessage(const std::list &callStack, const std::string& file0, Severity::SeverityType severity, const std::string &msg, const std::string &id, const CWE &cwe, bool inconclusive); + ErrorMessage(const std::list &callStack, const std::string& file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive); + ErrorMessage(const std::list &callStack, const std::string& file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, const CWE &cwe, bool inconclusive); ErrorMessage(const std::list& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, bool inconclusive); ErrorMessage(const std::list& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, const CWE &cwe, bool inconclusive); ErrorMessage(); diff --git a/lib/library.h b/lib/library.h index 4a72d277f..ab6d88175 100644 --- a/lib/library.h +++ b/lib/library.h @@ -324,7 +324,7 @@ public: bool reportErrors(const std::string &path) const; - bool ignorefunction(const std::string &function) const; + bool ignorefunction(const std::string &functionName) const; bool isexecutableblock(const std::string &file, const std::string &token) const; diff --git a/lib/mathlib.h b/lib/mathlib.h index 021bef58a..fd6d16a07 100644 --- a/lib/mathlib.h +++ b/lib/mathlib.h @@ -109,7 +109,7 @@ public: static bool isGreaterEqual(const std::string & first, const std::string & second); static bool isLess(const std::string & first, const std::string & second); static bool isLessEqual(const std::string & first, const std::string & second); - static bool isNullValue(const std::string &tok); + static bool isNullValue(const std::string & str); /** * Return true if given character is 0,1,2,3,4,5,6 or 7. * @param[in] c The character to check diff --git a/lib/path.h b/lib/path.h index cc6ea5107..9238c4790 100644 --- a/lib/path.h +++ b/lib/path.h @@ -142,7 +142,7 @@ public: * @param extra extra file extensions * @return true if the file extension indicates it should be checked */ - static bool acceptFile(const std::string &filename, const std::set &extra); + static bool acceptFile(const std::string &path, const std::set &extra); /** * @brief Identify language based on file extension. @@ -156,7 +156,7 @@ public: * @param extensionInLowerCase filename to check. path info is optional * @return true if extension is meant for C++ files */ - static bool isCPP(const std::string &extensionInLowerCase); + static bool isCPP(const std::string &path); /** * @brief Is filename a header based on file extension diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 01a8568a8..de1725433 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -119,14 +119,14 @@ void Preprocessor::inlineSuppressions(const simplecpp::TokenList &tokens) } } -void Preprocessor::setDirectives(const simplecpp::TokenList &tokens1) +void Preprocessor::setDirectives(const simplecpp::TokenList &tokens) { // directive list.. directives.clear(); std::vector list; list.reserve(1U + tokenlists.size()); - list.push_back(&tokens1); + list.push_back(&tokens); for (std::map::const_iterator it = tokenlists.begin(); it != tokenlists.end(); ++it) { list.push_back(it->second); } diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index bde47bc77..445ed4b5f 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -857,7 +857,7 @@ public: const Token *noexceptArg; const Token *throwArg; - static bool argsMatch(const Scope *info, const Token *first, const Token *second, const std::string &path, unsigned int depth); + static bool argsMatch(const Scope *scope, const Token *first, const Token *second, const std::string &path, unsigned int depth); /** * @return token to ":" if the function is a constructor @@ -1087,7 +1087,7 @@ public: * @param type token containing variable type * @return pointer to type if found or NULL if not found */ - const Type *findVariableType(const Scope *start, const Token *type) const; + const Type *findVariableType(const Scope *start, const Token *typeTok) const; /** * @brief find a function @@ -1098,7 +1098,7 @@ public: const Scope *findScopeByName(const std::string& name) const; - const Type* findType(const Token *tok, const Scope *startScope) const; + const Type* findType(const Token *startTok, const Scope *startScope) const; Type* findType(const Token *tok, Scope *startScope) const { return const_cast(this->findType(tok, const_cast(startScope))); } @@ -1168,12 +1168,12 @@ private: void createSymbolDatabaseEnums(); void createSymbolDatabaseUnknownArrayDimensions(); - void addClassFunction(Scope **info, const Token **tok, const Token *argStart); + void addClassFunction(Scope **scope, const Token **tok, const Token *argStart); 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); + void addNewFunction(Scope **scope, const Token **tok); bool isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart, const Token** declEnd) const; - const Type *findTypeInNested(const Token *tok, const Scope *startScope) const; + const Type *findTypeInNested(const Token *startTok, const Scope *startScope) const; const Scope *findNamespace(const Token * tok, const Scope * scope) const; Function *findFunctionInScope(const Token *func, const Scope *ns); const Type *findVariableTypeInBase(const Scope *scope, const Token *typeTok) const; @@ -1190,7 +1190,7 @@ private: void setValueType(Token *tok, const ValueType &valuetype); void setValueType(Token *tok, const Variable &var); - void setValueType(Token *tok, const Enumerator &enumerators); + void setValueType(Token *tok, const Enumerator &enumerator); const Tokenizer *_tokenizer; const Settings *_settings; diff --git a/lib/token.cpp b/lib/token.cpp index 694d64e7e..9ad77b3d9 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -33,8 +33,8 @@ #include -Token::Token(Token **t) : - tokensBack(t), +Token::Token(Token **tokens) : + tokensBack(tokens), _next(0), _previous(0), _link(0), diff --git a/lib/token.h b/lib/token.h index eb79f9113..a42640168 100644 --- a/lib/token.h +++ b/lib/token.h @@ -69,7 +69,7 @@ public: eNone }; - explicit Token(Token **tokensBack); + explicit Token(Token **tokens); ~Token(); template @@ -442,7 +442,7 @@ public: * 0 if needle was empty string * -1 if needle was not found */ - static int multiCompare(const Token *needle, const char *haystack, unsigned int varid); + static int multiCompare(const Token *tok, const char *haystack, unsigned int varid); unsigned int linenr() const { return _linenr;