diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 4f1e07474..9e73f6a81 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -577,7 +577,7 @@ void CheckClass::initializeVarList(const Function &func, std::listtokAt(2); // Skip "classname :: " - if (Token::Match(ftok, ":: %var% ")) + if (Token::Match(ftok, ":: %var%")) ftok = ftok->next(); while (Token::Match(ftok, "%var% ::")) ftok = ftok->tokAt(2); diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 62ddb5e01..6c553e6e8 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2566,7 +2566,7 @@ void CheckOther::checkInvalidFree() // If a previously-allocated pointer is assigned a completely new value, // we can't know if any subsequent free() on that pointer is valid or not. - else if (Token::Match(tok, "%var% = ")) { + else if (Token::Match(tok, "%var% =")) { allocatedVariables.erase(tok->varId()); } @@ -2819,18 +2819,18 @@ void CheckOther::checkAlwaysTrueOrFalseStringCompare() for (const Token* tok = _tokenizer->tokens(); tok; tok = tok->next()) { if (Token::Match(tok, "strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp (")) { - if (Token::Match(tok->tokAt(2), "%str% , %str% ")) { + if (Token::Match(tok->tokAt(2), "%str% , %str%")) { const std::string &str1 = tok->strAt(2); const std::string &str2 = tok->strAt(4); alwaysTrueFalseStringCompareError(tok, str1, str2); tok = tok->tokAt(5); - } else if (Token::Match(tok->tokAt(2), "%var% , %var% ")) { + } else if (Token::Match(tok->tokAt(2), "%var% , %var%")) { const std::string &str1 = tok->strAt(2); const std::string &str2 = tok->strAt(4); if (str1 == str2) alwaysTrueStringVariableCompareError(tok, str1, str2); tok = tok->tokAt(5); - } else if (Token::Match(tok->tokAt(2), "%var% . c_str ( ) , %var% . c_str ( ) ")) { + } else if (Token::Match(tok->tokAt(2), "%var% . c_str ( ) , %var% . c_str ( )")) { const std::string &str1 = tok->strAt(2); const std::string &str2 = tok->strAt(8); if (str1 == str2) @@ -2923,7 +2923,7 @@ void CheckOther::suspiciousStringCompareError(const Token* tok, const std::strin // Reference: // - http://www.cplusplus.com/reference/cmath/ //----------------------------------------------------------------------------- -void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(void) +void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse() { if (!_settings->isEnabled("warning")) return; diff --git a/lib/checkother.h b/lib/checkother.h index 0b1248a28..18f6081a5 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -266,7 +266,7 @@ public: void checkCastIntToCharAndBack(); /** @brief %Check for using of comparison functions evaluating always to true or false. */ - void checkComparisonFunctionIsAlwaysTrueOrFalse(void); + void checkComparisonFunctionIsAlwaysTrueOrFalse(); private: bool isUnsigned(const Variable *var) const; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 05e284261..1a543e6f7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2342,7 +2342,7 @@ static void setVarIdClassFunction(const std::string &classname, for (Token *tok2 = startToken; tok2 && tok2 != endToken; tok2 = tok2->next()) { if (tok2->varId() != 0 || !tok2->isName()) continue; - if (Token::Match(tok2->tokAt(-2), ("!!"+classname+" :: ").c_str())) + if (Token::Match(tok2->tokAt(-2), ("!!"+classname+" ::").c_str())) continue; if (Token::Match(tok2->tokAt(-2), "!!this . ")) continue;