diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp
index cec114d84..c4e118a68 100644
--- a/lib/cppcheck.cpp
+++ b/lib/cppcheck.cpp
@@ -396,7 +396,9 @@ Settings &CppCheck::settings()
void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg)
{
- std::string errmsg = msg.toString(_settings._verbose);
+ const std::string errmsg = msg.toString(_settings._verbose);
+ if (errmsg.empty())
+ return;
// Alert only about unique errors
if (std::find(_errorList.begin(), _errorList.end(), errmsg) != _errorList.end())
diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp
index c96c12854..a32874113 100644
--- a/lib/errorlogger.cpp
+++ b/lib/errorlogger.cpp
@@ -204,6 +204,10 @@ std::string ErrorLogger::ErrorMessage::toXML(bool verbose, int version) const
// The default xml format
if (version == 1)
{
+ // No inconclusive messages in the xml version 1
+ if (Severity::toString(_severity).compare(0,12,"inconclusive")==0)
+ return "";
+
xml << "\n ";
ASSERT_EQUALS(message, msg.toXML(false,2));
}
+
+ void InconclusiveXml()
+ {
+ // Location
+ ErrorLogger::ErrorMessage::FileLocation loc;
+ loc.setfile("foo.cpp");
+ loc.line = 5;
+ std::list locs;
+ locs.push_back(loc);
+
+ // Error message
+ ErrorMessage msg(locs, Severity::inconclusive_error, "Programming error", "errorId");
+
+ // Don't save inconclusive messages if the xml version is 1
+ ASSERT_EQUALS("", msg.toXML(false, 1));
+
+ // TODO: how should inconclusive messages be saved when the xml version is 2?
+ ASSERT_EQUALS("", msg.toXML(false, 2));
+ }
};
REGISTER_TEST(TestErrorLogger)