errmsg: Moved 'function parameter parname is passed by value' to the style checks
This commit is contained in:
parent
068b1458c2
commit
3d61334a8c
|
@ -389,7 +389,7 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
checkOther.CheckStructMemberUsage();
|
||||
|
||||
// Check if a constant function parameter is passed by value
|
||||
if (ErrorMessage::passedByValue())
|
||||
if (ErrorMessage::passedByValue(_settings))
|
||||
checkOther.CheckConstantFunctionParameter();
|
||||
|
||||
// Variable scope (check if the scope could be limited)
|
||||
|
|
|
@ -251,9 +251,9 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Function parameter '" + parname + "' is passed by value. It could be passed by reference instead.";
|
||||
}
|
||||
static bool passedByValue()
|
||||
static bool passedByValue(const Settings &s)
|
||||
{
|
||||
return true;
|
||||
return s._checkCodingStyle;
|
||||
}
|
||||
|
||||
static std::string constStatement(const Tokenizer *tokenizer, const Token *Location, const std::string &type)
|
||||
|
|
|
@ -86,7 +86,7 @@ int main()
|
|||
err.push_back(Message("udivError", Message::always, "Unsigned division. The result will be wrong."));
|
||||
err.push_back(Message("udivWarning", Message::style_all, "Warning: Division with signed and unsigned operators"));
|
||||
err.push_back(Message("unusedStructMember", Message::style, "struct or union member '%1::%2' is never used", "structname", "varname"));
|
||||
err.push_back(Message("passedByValue", Message::always, "Function parameter '%1' is passed by value. It could be passed by reference instead.", "parname"));
|
||||
err.push_back(Message("passedByValue", Message::style, "Function parameter '%1' is passed by value. It could be passed by reference instead.", "parname"));
|
||||
err.push_back(Message("constStatement", Message::style, "Redundant code: Found a statement that begins with %1 constant", "type"));
|
||||
err.push_back(Message("charArrayIndex", Message::style, "Warning - using char variable as array index"));
|
||||
err.push_back(Message("charBitOp", Message::style, "Warning - using char variable in bit operation"));
|
||||
|
|
Loading…
Reference in New Issue