CLI: Give files to Cppcheck class one at a time.
When doing single-threaded checking give checked files to Cppcheck class one file at a time. Like GUI and multithreaded checking already do. This unifies how we call Cppcheck class from different clients.
This commit is contained in:
parent
3c415e7833
commit
903769a388
|
@ -114,7 +114,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
|
||||||
{
|
{
|
||||||
std::vector<std::string>::iterator iter;
|
std::vector<std::string>::iterator iter;
|
||||||
for (iter = filenames.begin(); iter != filenames.end(); ++iter)
|
for (iter = filenames.begin(); iter != filenames.end(); ++iter)
|
||||||
cppcheck->addFile(*iter);
|
_filenames.push_back(*iter);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,14 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
||||||
if (_settings._jobs == 1)
|
if (_settings._jobs == 1)
|
||||||
{
|
{
|
||||||
// Single process
|
// Single process
|
||||||
returnValue = cppCheck.check();
|
for (unsigned int c = 0; c < _filenames.size(); c++)
|
||||||
|
{
|
||||||
|
cppCheck.addFile(_filenames[c]);
|
||||||
|
returnValue += cppCheck.check();
|
||||||
|
cppCheck.clearFiles();
|
||||||
|
|
||||||
|
reportStatus(c + 1, _filenames.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!ThreadExecutor::isEnabled())
|
else if (!ThreadExecutor::isEnabled())
|
||||||
{
|
{
|
||||||
|
@ -155,9 +162,8 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Multiple processes
|
// Multiple processes
|
||||||
const std::vector<std::string> &filenames = cppCheck.filenames();
|
|
||||||
Settings &settings = cppCheck.settings();
|
Settings &settings = cppCheck.settings();
|
||||||
ThreadExecutor executor(filenames, settings, *this);
|
ThreadExecutor executor(_filenames, settings, *this);
|
||||||
returnValue = executor.check();
|
returnValue = executor.check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "errorlogger.h"
|
#include "errorlogger.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class CppCheck;
|
class CppCheck;
|
||||||
|
|
||||||
|
@ -107,6 +108,11 @@ private:
|
||||||
* Has --errorlist been given?
|
* Has --errorlist been given?
|
||||||
*/
|
*/
|
||||||
bool errorlist;
|
bool errorlist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of files to check.
|
||||||
|
*/
|
||||||
|
std::vector<std::string> _filenames;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPPCHECKEXECUTOR_H
|
#endif // CPPCHECKEXECUTOR_H
|
||||||
|
|
Loading…
Reference in New Issue