From 6ceab1f2456961fbcf593444a8b0789614d391bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 23 Sep 2018 17:27:38 +0200 Subject: [PATCH] New fix for #8771. Remove line attribute in when there is no line. This is more 'proper'. --- lib/errorlogger.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index ea240772b..55f159dea 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -401,7 +401,8 @@ 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()); - printer.PushAttribute("line", (*it).line); + 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()); printer.CloseElement(false); @@ -568,7 +569,7 @@ void ErrorLogger::reportUnmatchedSuppressions(const std::list 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)); } }