New fix for #8771. Remove line attribute in <location> when there is no line. This is more 'proper'.

This commit is contained in:
Daniel Marjamäki 2018-09-23 17:27:38 +02:00
parent 83e8465d18
commit 6ceab1f245
1 changed files with 3 additions and 2 deletions

View File

@ -401,6 +401,7 @@ std::string ErrorLogger::ErrorMessage::toXML() const
if (!file0.empty() && (*it).getfile() != file0)
printer.PushAttribute("file0", Path::toNativeSeparators(file0).c_str());
printer.PushAttribute("file", (*it).getfile().c_str());
if (it->line != (unsigned int)Suppressions::Suppression::NO_LINE)
printer.PushAttribute("line", (*it).line);
if (!it->getinfo().empty())
printer.PushAttribute("info", it->getinfo().c_str());
@ -568,7 +569,7 @@ void ErrorLogger::reportUnmatchedSuppressions(const std::list<Suppressions::Supp
std::list<ErrorLogger::ErrorMessage::FileLocation> callStack;
if (!s.fileName.empty())
callStack.emplace_back(s.fileName, std::max(0, s.lineNumber));
callStack.emplace_back(s.fileName, s.lineNumber);
reportErr(ErrorLogger::ErrorMessage(callStack, emptyString, Severity::information, "Unmatched suppression: " + s.errorId, "unmatchedSuppression", false));
}
}