Don't set Preprocessor::missingIncludeFlag if missingInclude warning is suppressed (#3487).
This commit is contained in:
parent
0157f937bf
commit
279b0c59bb
|
@ -1915,7 +1915,7 @@ std::string Preprocessor::handleIncludes(const std::string &code, const std::str
|
|||
if (!openHeader(filename, includePaths, filepath, fin)) {
|
||||
|
||||
if (_settings && (headerType == UserHeader || _settings->debugwarnings)) {
|
||||
if (!_settings->nomsg.isSuppressed("missingInclude", "", 0)) {
|
||||
if (!_settings->nomsg.isSuppressed("missingInclude", filename, linenr)) {
|
||||
missingIncludeFlag = true;
|
||||
|
||||
missingInclude(Path::toNativeSeparators(filePath),
|
||||
|
@ -2023,10 +2023,6 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
|
|||
path.erase(1 + path.find_last_of("\\/"));
|
||||
paths.push_back(path);
|
||||
} else if (!fileOpened && _settings && (headerType == UserHeader || _settings->debugwarnings)) {
|
||||
if (!_settings->nomsg.isSuppressed("missingInclude", "", 0))
|
||||
missingIncludeFlag = true;
|
||||
|
||||
if (_errorLogger && _settings->checkConfiguration) {
|
||||
std::string f = filePath;
|
||||
|
||||
// Determine line number of include
|
||||
|
@ -2050,6 +2046,8 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
|
|||
}
|
||||
|
||||
if (!_settings->nomsg.isSuppressed("missingInclude", f, linenr)) {
|
||||
missingIncludeFlag = true;
|
||||
if (_errorLogger && _settings->checkConfiguration) {
|
||||
missingInclude(Path::toNativeSeparators(f),
|
||||
linenr,
|
||||
filename,
|
||||
|
|
|
@ -2912,6 +2912,7 @@ private:
|
|||
}
|
||||
|
||||
void inline_suppression_for_missing_include() {
|
||||
Preprocessor::missingIncludeFlag = false;
|
||||
Settings settings;
|
||||
settings._inlineSuppressions = true;
|
||||
settings.addEnabled("all");
|
||||
|
@ -2928,6 +2929,7 @@ private:
|
|||
errout.str("");
|
||||
preprocessor.preprocess(src, processedFile, cfg, "test.c", paths);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag);
|
||||
}
|
||||
|
||||
void predefine1() {
|
||||
|
|
Loading…
Reference in New Issue