cppcheck: output errorlist to stdout
This commit is contained in:
parent
61aa86f201
commit
657c22d23b
|
@ -29,6 +29,7 @@
|
|||
CppCheckExecutor::CppCheckExecutor()
|
||||
{
|
||||
time1 = 0;
|
||||
errorlist = false;
|
||||
}
|
||||
|
||||
CppCheckExecutor::~CppCheckExecutor()
|
||||
|
@ -52,7 +53,10 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
|
|||
|
||||
if (parser.GetShowErrorMessages())
|
||||
{
|
||||
errorlist = true;
|
||||
std::cout << ErrorLogger::ErrorMessage::getXMLHeader(_settings._xml_version);
|
||||
cppcheck->getErrorMessages();
|
||||
std::cout << ErrorLogger::ErrorMessage::getXMLFooter() << std::endl;
|
||||
std::exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +203,11 @@ void CppCheckExecutor::reportStatus(unsigned int index, unsigned int max)
|
|||
|
||||
void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
|
||||
{
|
||||
if (_settings._xml)
|
||||
if (errorlist)
|
||||
{
|
||||
reportOut(msg.toXML(false, _settings._xml_version));
|
||||
}
|
||||
else if (_settings._xml)
|
||||
{
|
||||
reportErr(msg.toXML(_settings._verbose, _settings._xml_version));
|
||||
}
|
||||
|
|
|
@ -102,6 +102,11 @@ private:
|
|||
* Report progress time
|
||||
*/
|
||||
std::time_t time1;
|
||||
|
||||
/**
|
||||
* Has --errorlist been given?
|
||||
*/
|
||||
bool errorlist;
|
||||
};
|
||||
|
||||
#endif // CPPCHECKEXECUTOR_H
|
||||
|
|
|
@ -440,7 +440,6 @@ void CppCheck::reportStatus(unsigned int /*index*/, unsigned int /*max*/)
|
|||
void CppCheck::getErrorMessages()
|
||||
{
|
||||
// call all "getErrorMessages" in all registered Check classes
|
||||
std::cout << ErrorLogger::ErrorMessage::getXMLHeader(_settings._xml_version);
|
||||
for (std::list<Check *>::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it)
|
||||
(*it)->getErrorMessages(this, &_settings);
|
||||
|
||||
|
@ -448,6 +447,4 @@ void CppCheck::getErrorMessages()
|
|||
tokenizer.getErrorMessages(this, &_settings);
|
||||
|
||||
Preprocessor::getErrorMessages(this, &_settings);
|
||||
|
||||
std::cout << ErrorLogger::ErrorMessage::getXMLFooter() << std::endl;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue