switchCaseFallThrough is now an inconclusive check

This commit is contained in:
Greg Hewgill 2011-03-06 13:06:30 +13:00
parent c8394909c0
commit b9df7735c5
3 changed files with 5 additions and 4 deletions

View File

@ -309,7 +309,7 @@ void CheckOther::checkRedundantAssignmentInSwitch()
void CheckOther::checkSwitchCaseFallThrough()
{
if (!_settings->_checkCodingStyle)
if (!(_settings->_checkCodingStyle && _settings->inconclusive))
return;
const char switchPattern[] = "switch (";

View File

@ -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;
}
@ -438,7 +438,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
}
std::string comment(str, commentStart, i - commentStart - 1);
if (_settings->_checkCodingStyle && isFallThroughComment(comment))
if (isFallThroughComment(comment))
{
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
// 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 tok = str.substr(i, j - i);

View File

@ -184,6 +184,7 @@ private:
Settings settings;
settings._checkCodingStyle = true;
settings.inconclusive = true;
// Preprocess file..
Preprocessor preprocessor(&settings, this);