diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index db903d41e..31e6ce6c9 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -27,7 +27,6 @@ #include "xmlreport.h" #include "xmlreportv2.h" #include "cppcheck.h" -#include "path.h" static const char ResultElementName[] = "results"; static const char CppcheckElementName[] = "cppcheck"; @@ -122,7 +121,7 @@ void XmlReportV2::WriteError(const ErrorItem &error) mXmlWriter->writeStartElement(LocationElementName); QString file = QDir::toNativeSeparators(error.files[i]); - if (Path::isHeader(file.toStdString()) && !error.file0.isEmpty()) { + if (!error.file0.isEmpty() && file != error.file0) { mXmlWriter->writeAttribute(IncludedFromFilenameAttribute, quoteMessage(error.file0)); } file = XmlReport::quoteMessage(file); diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index f04be089e..752f81731 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -287,7 +287,7 @@ std::string ErrorLogger::ErrorMessage::toXML(bool verbose, int version) const for (std::list::const_reverse_iterator it = _callStack.rbegin(); it != _callStack.rend(); ++it) { printer.OpenElement("location", false); - if (Path::isHeader((*it).getfile()) && !file0.empty()) + 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);