CppCheckExecutor: do not modify settings after they were passed to `CppCheck` (#5697)
This commit is contained in:
parent
8e1ae7e412
commit
1d3f9beb21
|
@ -183,10 +183,13 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.loadSummaries();
|
||||||
|
|
||||||
mFiles = parser.getFiles();
|
mFiles = parser.getFiles();
|
||||||
mFileSettings = parser.getFileSettings();
|
mFileSettings = parser.getFileSettings();
|
||||||
|
|
||||||
mStdLogger = new StdLogger(settings);
|
mStdLogger = new StdLogger(settings);
|
||||||
|
|
||||||
CppCheck cppCheck(*mStdLogger, true, executeCommand);
|
CppCheck cppCheck(*mStdLogger, true, executeCommand);
|
||||||
cppCheck.settings() = settings;
|
cppCheck.settings() = settings;
|
||||||
|
|
||||||
|
@ -230,9 +233,10 @@ bool CppCheckExecutor::reportSuppressions(const Settings &settings, bool unusedF
|
||||||
/*
|
/*
|
||||||
* That is a method which gets called from check_wrapper
|
* That is a method which gets called from check_wrapper
|
||||||
* */
|
* */
|
||||||
int CppCheckExecutor::check_internal(CppCheck& cppcheck)
|
int CppCheckExecutor::check_internal(CppCheck& cppcheck) const
|
||||||
{
|
{
|
||||||
Settings& settings = cppcheck.settings();
|
const auto& settings = cppcheck.settings();
|
||||||
|
auto& suppressions = cppcheck.settings().nomsg;
|
||||||
|
|
||||||
if (settings.reportProgress >= 0)
|
if (settings.reportProgress >= 0)
|
||||||
mStdLogger->resetLatestProgressOutputTime();
|
mStdLogger->resetLatestProgressOutputTime();
|
||||||
|
@ -242,8 +246,6 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings.buildDir.empty()) {
|
if (!settings.buildDir.empty()) {
|
||||||
settings.loadSummaries();
|
|
||||||
|
|
||||||
std::list<std::string> fileNames;
|
std::list<std::string> fileNames;
|
||||||
for (std::list<std::pair<std::string, std::size_t>>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i)
|
for (std::list<std::pair<std::string, std::size_t>>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i)
|
||||||
fileNames.emplace_back(i->first);
|
fileNames.emplace_back(i->first);
|
||||||
|
@ -256,13 +258,13 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
|
||||||
unsigned int returnValue;
|
unsigned int returnValue;
|
||||||
if (settings.useSingleJob()) {
|
if (settings.useSingleJob()) {
|
||||||
// Single process
|
// Single process
|
||||||
SingleExecutor executor(cppcheck, mFiles, mFileSettings, settings, settings.nomsg, *mStdLogger);
|
SingleExecutor executor(cppcheck, mFiles, mFileSettings, settings, suppressions, *mStdLogger);
|
||||||
returnValue = executor.check();
|
returnValue = executor.check();
|
||||||
} else {
|
} else {
|
||||||
#if defined(THREADING_MODEL_THREAD)
|
#if defined(THREADING_MODEL_THREAD)
|
||||||
ThreadExecutor executor(mFiles, mFileSettings, settings, settings.nomsg, *mStdLogger, CppCheckExecutor::executeCommand);
|
ThreadExecutor executor(mFiles, mFileSettings, settings, suppressions, *mStdLogger, CppCheckExecutor::executeCommand);
|
||||||
#elif defined(THREADING_MODEL_FORK)
|
#elif defined(THREADING_MODEL_FORK)
|
||||||
ProcessExecutor executor(mFiles, mFileSettings, settings, settings.nomsg, *mStdLogger, CppCheckExecutor::executeCommand);
|
ProcessExecutor executor(mFiles, mFileSettings, settings, suppressions, *mStdLogger, CppCheckExecutor::executeCommand);
|
||||||
#endif
|
#endif
|
||||||
returnValue = executor.check();
|
returnValue = executor.check();
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ protected:
|
||||||
* given value is returned instead of default 0.
|
* given value is returned instead of default 0.
|
||||||
* If no errors are found, 0 is returned.
|
* If no errors are found, 0 is returned.
|
||||||
*/
|
*/
|
||||||
int check_internal(CppCheck& cppcheck);
|
int check_internal(CppCheck& cppcheck) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filename associated with size of file
|
* Filename associated with size of file
|
||||||
|
|
|
@ -253,7 +253,7 @@ namespace {
|
||||||
* TODO Check for multi-threading issues!
|
* TODO Check for multi-threading issues!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int check_wrapper_seh(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&), CppCheck& cppcheck)
|
int check_wrapper_seh(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&) const, CppCheck& cppcheck)
|
||||||
{
|
{
|
||||||
FILE *outputFile = CppCheckExecutor::getExceptionOutput();
|
FILE *outputFile = CppCheckExecutor::getExceptionOutput();
|
||||||
__try {
|
__try {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
class CppCheckExecutor;
|
class CppCheckExecutor;
|
||||||
class CppCheck;
|
class CppCheck;
|
||||||
|
|
||||||
int check_wrapper_seh(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&), CppCheck& cppcheck);
|
int check_wrapper_seh(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&) const, CppCheck& cppcheck);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_wrapper_sig(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&), CppCheck& cppcheck)
|
int check_wrapper_sig(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&) const, CppCheck& cppcheck)
|
||||||
{
|
{
|
||||||
// determine stack vs. heap
|
// determine stack vs. heap
|
||||||
char stackVariable;
|
char stackVariable;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
class CppCheckExecutor;
|
class CppCheckExecutor;
|
||||||
class CppCheck;
|
class CppCheck;
|
||||||
|
|
||||||
int check_wrapper_sig(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&), CppCheck& cppcheck);
|
int check_wrapper_sig(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(CppCheck&) const, CppCheck& cppcheck);
|
||||||
|
|
||||||
#endif // CPPCHECKEXECUTORSIG_H
|
#endif // CPPCHECKEXECUTORSIG_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue