switchCaseFallThrough is now an inconclusive check
This commit is contained in:
parent
c8394909c0
commit
b9df7735c5
|
@ -309,7 +309,7 @@ void CheckOther::checkRedundantAssignmentInSwitch()
|
||||||
|
|
||||||
void CheckOther::checkSwitchCaseFallThrough()
|
void CheckOther::checkSwitchCaseFallThrough()
|
||||||
{
|
{
|
||||||
if (!_settings->_checkCodingStyle)
|
if (!(_settings->_checkCodingStyle && _settings->inconclusive))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char switchPattern[] = "switch (";
|
const char switchPattern[] = "switch (";
|
||||||
|
|
|
@ -411,7 +411,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_settings->_checkCodingStyle && isFallThroughComment(comment))
|
if (isFallThroughComment(comment))
|
||||||
{
|
{
|
||||||
fallThroughComment = true;
|
fallThroughComment = true;
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
||||||
}
|
}
|
||||||
std::string comment(str, commentStart, i - commentStart - 1);
|
std::string comment(str, commentStart, i - commentStart - 1);
|
||||||
|
|
||||||
if (_settings->_checkCodingStyle && isFallThroughComment(comment))
|
if (isFallThroughComment(comment))
|
||||||
{
|
{
|
||||||
fallThroughComment = true;
|
fallThroughComment = true;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
||||||
|
|
||||||
// First check for a "fall through" comment match, but only
|
// First check for a "fall through" comment match, but only
|
||||||
// add a suppression if the next token is 'case' or 'default'
|
// add a suppression if the next token is 'case' or 'default'
|
||||||
if (fallThroughComment)
|
if (_settings->_checkCodingStyle && _settings->inconclusive && fallThroughComment)
|
||||||
{
|
{
|
||||||
std::string::size_type j = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz", i);
|
std::string::size_type j = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz", i);
|
||||||
std::string tok = str.substr(i, j - i);
|
std::string tok = str.substr(i, j - i);
|
||||||
|
|
|
@ -184,6 +184,7 @@ private:
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings._checkCodingStyle = true;
|
settings._checkCodingStyle = true;
|
||||||
|
settings.inconclusive = true;
|
||||||
|
|
||||||
// Preprocess file..
|
// Preprocess file..
|
||||||
Preprocessor preprocessor(&settings, this);
|
Preprocessor preprocessor(&settings, this);
|
||||||
|
|
Loading…
Reference in New Issue