Class checking: made 'technically function x can be const' inconclusive
This commit is contained in:
parent
b26811cdf5
commit
77925dc629
|
@ -1166,6 +1166,10 @@ void CheckClass::thisSubtractionError(const Token *tok)
|
||||||
|
|
||||||
void CheckClass::checkConst()
|
void CheckClass::checkConst()
|
||||||
{
|
{
|
||||||
|
// this is an inconclusive check - see #3048 for instance
|
||||||
|
if (!_settings->inconclusive)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_settings->isEnabled("style") || _settings->ifcfg)
|
if (!_settings->isEnabled("style") || _settings->ifcfg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1548,7 +1552,7 @@ bool CheckClass::isVirtualFunc(const Scope *scope, const Token *functionToken) c
|
||||||
|
|
||||||
void CheckClass::checkConstError(const Token *tok, const std::string &classname, const std::string &funcname)
|
void CheckClass::checkConstError(const Token *tok, const std::string &classname, const std::string &funcname)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::style, "functionConst",
|
reportInconclusiveError(tok, Severity::style, "functionConst",
|
||||||
"Technically the member function '" + classname + "::" + funcname + "' can be const.\n"
|
"Technically the member function '" + classname + "::" + funcname + "' can be const.\n"
|
||||||
"The member function '" + classname + "::" + funcname + "' can be made a const "
|
"The member function '" + classname + "::" + funcname + "' can be made a const "
|
||||||
"function. Making this function const function should not cause compiler errors. "
|
"function. Making this function const function should not cause compiler errors. "
|
||||||
|
@ -1562,7 +1566,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st
|
||||||
std::list<const Token *> toks;
|
std::list<const Token *> toks;
|
||||||
toks.push_back(tok1);
|
toks.push_back(tok1);
|
||||||
toks.push_back(tok2);
|
toks.push_back(tok2);
|
||||||
reportError(toks, Severity::style, "functionConst",
|
reportInconclusiveError(toks, Severity::style, "functionConst",
|
||||||
"Technically the member function '" + classname + "::" + funcname + "' can be const.\n"
|
"Technically the member function '" + classname + "::" + funcname + "' can be const.\n"
|
||||||
"The member function '" + classname + "::" + funcname + "' can be made a const "
|
"The member function '" + classname + "::" + funcname + "' can be made a const "
|
||||||
"function. Making this function const function should not cause compiler errors. "
|
"function. Making this function const function should not cause compiler errors. "
|
||||||
|
|
|
@ -3518,6 +3518,7 @@ private:
|
||||||
settings = *s;
|
settings = *s;
|
||||||
else
|
else
|
||||||
settings.addEnabled("style");
|
settings.addEnabled("style");
|
||||||
|
settings.inconclusive = true;
|
||||||
|
|
||||||
// Tokenize..
|
// Tokenize..
|
||||||
Tokenizer tokenizer(&settings, this);
|
Tokenizer tokenizer(&settings, this);
|
||||||
|
|
Loading…
Reference in New Issue