handle inline suppressions in included files

This commit is contained in:
Daniel Marjamäki 2016-07-21 07:57:23 +02:00
parent e16f0e500c
commit 9899e81f2e
1 changed files with 12 additions and 5 deletions

View File

@ -85,11 +85,8 @@ void Preprocessor::writeError(const std::string &fileName, const unsigned int li
}
void Preprocessor::inlineSuppressions(const simplecpp::TokenList &tokens)
static void inlineSuppressions(const simplecpp::TokenList &tokens, Settings &_settings)
{
if (!_settings.inlineSuppressions)
return;
std::list<std::string> suppressionIDs;
for (const simplecpp::Token *tok = tokens.cbegin(); tok; tok = tok->next) {
@ -119,7 +116,6 @@ void Preprocessor::inlineSuppressions(const simplecpp::TokenList &tokens)
}
}
// Add the suppressions.
for (std::list<std::string>::const_iterator it = suppressionIDs.begin(); it != suppressionIDs.end(); ++it) {
_settings.nomsg.addSuppression(*it, relativeFilename, tok->location.line);
@ -128,6 +124,17 @@ void Preprocessor::inlineSuppressions(const simplecpp::TokenList &tokens)
}
}
void Preprocessor::inlineSuppressions(const simplecpp::TokenList &tokens)
{
if (!_settings.inlineSuppressions)
return;
::inlineSuppressions(tokens, _settings);
for (std::map<std::string,simplecpp::TokenList*>::const_iterator it = tokenlists.begin(); it != tokenlists.end(); ++it) {
if (it->second)
::inlineSuppressions(*it->second, _settings);
}
}
static std::string readcondition(const simplecpp::Token *iftok, const std::set<std::string> &defined)
{
const simplecpp::Token *cond = iftok->next;