recognise fall through in c style comments
This commit is contained in:
parent
ad45737805
commit
610d2efaea
|
@ -392,7 +392,8 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
}
|
||||
}
|
||||
|
||||
if (comment.find("fall through") != std::string::npos)
|
||||
std::transform(comment.begin(), comment.end(), comment.begin(), ::tolower);
|
||||
if (comment.find("fall") != std::string::npos && comment.find("thr") != std::string::npos)
|
||||
{
|
||||
suppressionIDs.push_back("switchCaseFallThrough");
|
||||
}
|
||||
|
@ -417,10 +418,16 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
++lineno;
|
||||
}
|
||||
}
|
||||
std::string comment(str, commentStart, i - commentStart);
|
||||
|
||||
std::transform(comment.begin(), comment.end(), comment.begin(), ::tolower);
|
||||
if (comment.find("fall") != std::string::npos && comment.find("thr") != std::string::npos)
|
||||
{
|
||||
suppressionIDs.push_back("switchCaseFallThrough");
|
||||
}
|
||||
|
||||
if (settings && settings->_inlineSuppressions)
|
||||
{
|
||||
std::string comment(str, commentStart, i - commentStart);
|
||||
std::istringstream iss(comment);
|
||||
std::string word;
|
||||
iss >> word;
|
||||
|
|
|
@ -1263,6 +1263,18 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_preprocess_suppress(
|
||||
"void foo() {\n"
|
||||
" switch (a) {\n"
|
||||
" case 1:\n"
|
||||
" g();\n"
|
||||
" /* FALLTHRU */\n"
|
||||
" case 2:\n"
|
||||
" break;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_preprocess_suppress(
|
||||
"void foo() {\n"
|
||||
" switch (a) {\n"
|
||||
|
|
Loading…
Reference in New Issue