Settings: Remove '_' prefix for public member variables

This commit is contained in:
Daniel Marjamäki 2016-01-03 16:18:17 +01:00
parent 8dccbfefcf
commit 79e663dd6f
19 changed files with 241 additions and 242 deletions

View File

@ -228,30 +228,30 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
// Enables inline suppressions. // Enables inline suppressions.
else if (std::strcmp(argv[i], "--inline-suppr") == 0) else if (std::strcmp(argv[i], "--inline-suppr") == 0)
_settings->_inlineSuppressions = true; _settings->inlineSuppressions = true;
// Verbose error messages (configuration info) // Verbose error messages (configuration info)
else if (std::strcmp(argv[i], "-v") == 0 || std::strcmp(argv[i], "--verbose") == 0) else if (std::strcmp(argv[i], "-v") == 0 || std::strcmp(argv[i], "--verbose") == 0)
_settings->_verbose = true; _settings->verbose = true;
// Force checking of files that have "too many" configurations // Force checking of files that have "too many" configurations
else if (std::strcmp(argv[i], "-f") == 0 || std::strcmp(argv[i], "--force") == 0) else if (std::strcmp(argv[i], "-f") == 0 || std::strcmp(argv[i], "--force") == 0)
_settings->_force = true; _settings->force = true;
// Output relative paths // Output relative paths
else if (std::strcmp(argv[i], "-rp") == 0 || std::strcmp(argv[i], "--relative-paths") == 0) else if (std::strcmp(argv[i], "-rp") == 0 || std::strcmp(argv[i], "--relative-paths") == 0)
_settings->_relativePaths = true; _settings->relativePaths = true;
else if (std::strncmp(argv[i], "-rp=", 4) == 0 || std::strncmp(argv[i], "--relative-paths=", 17) == 0) { else if (std::strncmp(argv[i], "-rp=", 4) == 0 || std::strncmp(argv[i], "--relative-paths=", 17) == 0) {
_settings->_relativePaths = true; _settings->relativePaths = true;
if (argv[i][argv[i][3]=='='?4:17] != 0) { if (argv[i][argv[i][3]=='='?4:17] != 0) {
std::string paths = argv[i]+(argv[i][3]=='='?4:17); std::string paths = argv[i]+(argv[i][3]=='='?4:17);
for (;;) { for (;;) {
std::string::size_type pos = paths.find(';'); std::string::size_type pos = paths.find(';');
if (pos == std::string::npos) { if (pos == std::string::npos) {
_settings->_basePaths.push_back(Path::fromNativeSeparators(paths)); _settings->basePaths.push_back(Path::fromNativeSeparators(paths));
break; break;
} else { } else {
_settings->_basePaths.push_back(Path::fromNativeSeparators(paths.substr(0, pos))); _settings->basePaths.push_back(Path::fromNativeSeparators(paths.substr(0, pos)));
paths.erase(0, pos + 1); paths.erase(0, pos + 1);
} }
} }
@ -263,26 +263,26 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
// Write results in results.xml // Write results in results.xml
else if (std::strcmp(argv[i], "--xml") == 0) else if (std::strcmp(argv[i], "--xml") == 0)
_settings->_xml = true; _settings->xml = true;
// Define the XML file version (and enable XML output) // Define the XML file version (and enable XML output)
else if (std::strncmp(argv[i], "--xml-version=", 14) == 0) { else if (std::strncmp(argv[i], "--xml-version=", 14) == 0) {
std::string numberString(argv[i]+14); std::string numberString(argv[i]+14);
std::istringstream iss(numberString); std::istringstream iss(numberString);
if (!(iss >> _settings->_xml_version)) { if (!(iss >> _settings->xml_version)) {
PrintMessage("cppcheck: argument to '--xml-version' is not a number."); PrintMessage("cppcheck: argument to '--xml-version' is not a number.");
return false; return false;
} }
if (_settings->_xml_version < 0 || _settings->_xml_version > 2) { if (_settings->xml_version < 0 || _settings->xml_version > 2) {
// We only have xml versions 1 and 2 // We only have xml versions 1 and 2
PrintMessage("cppcheck: '--xml-version' can only be 1 or 2."); PrintMessage("cppcheck: '--xml-version' can only be 1 or 2.");
return false; return false;
} }
// Enable also XML if version is set // Enable also XML if version is set
_settings->_xml = true; _settings->xml = true;
} }
// Only print something when there are errors // Only print something when there are errors
@ -326,8 +326,8 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
else if (std::strncmp(argv[i], "--error-exitcode=", 17) == 0) { else if (std::strncmp(argv[i], "--error-exitcode=", 17) == 0) {
std::string temp = argv[i]+17; std::string temp = argv[i]+17;
std::istringstream iss(temp); std::istringstream iss(temp);
if (!(iss >> _settings->_exitCode)) { if (!(iss >> _settings->exitCode)) {
_settings->_exitCode = 0; _settings->exitCode = 0;
PrintMessage("cppcheck: Argument must be an integer. Try something like '--error-exitcode=1'."); PrintMessage("cppcheck: Argument must be an integer. Try something like '--error-exitcode=1'.");
return false; return false;
} }
@ -414,7 +414,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
if (path.back() != '/') if (path.back() != '/')
path += '/'; path += '/';
_settings->_includePaths.push_back(path); _settings->includePaths.push_back(path);
} else if (std::strncmp(argv[i], "--include=", 10) == 0) { } else if (std::strncmp(argv[i], "--include=", 10) == 0) {
std::string path = argv[i] + 10; std::string path = argv[i] + 10;
@ -423,7 +423,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
_settings->userIncludes.push_back(path); _settings->userIncludes.push_back(path);
} else if (std::strncmp(argv[i], "--includes-file=", 16) == 0) { } else if (std::strncmp(argv[i], "--includes-file=", 16) == 0) {
// open this file and read every input file (1 file name per line) // open this file and read every input file (1 file name per line)
AddInclPathsToList(16 + argv[i], &_settings->_includePaths); AddInclPathsToList(16 + argv[i], &_settings->includePaths);
} else if (std::strncmp(argv[i], "--config-exclude=",17) ==0) { } else if (std::strncmp(argv[i], "--config-exclude=",17) ==0) {
std::string path = argv[i] + 17; std::string path = argv[i] + 17;
path = Path::fromNativeSeparators(path); path = Path::fromNativeSeparators(path);
@ -503,21 +503,21 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
std::strncmp(argv[i], "--template=", 11) == 0) { std::strncmp(argv[i], "--template=", 11) == 0) {
// "--template path/" // "--template path/"
if (argv[i][10] == '=') if (argv[i][10] == '=')
_settings->_outputFormat = argv[i] + 11; _settings->outputFormat = argv[i] + 11;
else if ((i+1) < argc && argv[i+1][0] != '-') { else if ((i+1) < argc && argv[i+1][0] != '-') {
++i; ++i;
_settings->_outputFormat = argv[i]; _settings->outputFormat = argv[i];
} else { } else {
PrintMessage("cppcheck: argument to '--template' is missing."); PrintMessage("cppcheck: argument to '--template' is missing.");
return false; return false;
} }
if (_settings->_outputFormat == "gcc") if (_settings->outputFormat == "gcc")
_settings->_outputFormat = "{file}:{line}: {severity}: {message}"; _settings->outputFormat = "{file}:{line}: {severity}: {message}";
else if (_settings->_outputFormat == "vs") else if (_settings->outputFormat == "vs")
_settings->_outputFormat = "{file}({line}): {severity}: {message}"; _settings->outputFormat = "{file}({line}): {severity}: {message}";
else if (_settings->_outputFormat == "edit") else if (_settings->outputFormat == "edit")
_settings->_outputFormat = "{file} +{line}: {severity}: {message}"; _settings->outputFormat = "{file} +{line}: {severity}: {message}";
} }
// Checking threads // Checking threads
@ -540,12 +540,12 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
numberString = argv[i]+2; numberString = argv[i]+2;
std::istringstream iss(numberString); std::istringstream iss(numberString);
if (!(iss >> _settings->_jobs)) { if (!(iss >> _settings->jobs)) {
PrintMessage("cppcheck: argument to '-j' is not a number."); PrintMessage("cppcheck: argument to '-j' is not a number.");
return false; return false;
} }
if (_settings->_jobs > 10000) { if (_settings->jobs > 10000) {
// This limit is here just to catch typos. If someone has // This limit is here just to catch typos. If someone has
// need for more jobs, this value should be increased. // need for more jobs, this value should be increased.
PrintMessage("cppcheck: argument for '-j' is allowed to be 10000 at max."); PrintMessage("cppcheck: argument for '-j' is allowed to be 10000 at max.");
@ -570,7 +570,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
numberString = argv[i]+2; numberString = argv[i]+2;
std::istringstream iss(numberString); std::istringstream iss(numberString);
if (!(iss >> _settings->_loadAverage)) { if (!(iss >> _settings->loadAverage)) {
PrintMessage("cppcheck: argument to '-l' is not a number."); PrintMessage("cppcheck: argument to '-l' is not a number.");
return false; return false;
} }
@ -579,7 +579,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
// print all possible error messages.. // print all possible error messages..
else if (std::strcmp(argv[i], "--errorlist") == 0) { else if (std::strcmp(argv[i], "--errorlist") == 0) {
_showErrorMessages = true; _showErrorMessages = true;
_settings->_xml = true; _settings->xml = true;
_exitAfterPrint = true; _exitAfterPrint = true;
} }
@ -604,13 +604,13 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
else if (std::strncmp(argv[i], "--showtime=", 11) == 0) { else if (std::strncmp(argv[i], "--showtime=", 11) == 0) {
const std::string showtimeMode = argv[i] + 11; const std::string showtimeMode = argv[i] + 11;
if (showtimeMode == "file") if (showtimeMode == "file")
_settings->_showtime = SHOWTIME_FILE; _settings->showtime = SHOWTIME_FILE;
else if (showtimeMode == "summary") else if (showtimeMode == "summary")
_settings->_showtime = SHOWTIME_SUMMARY; _settings->showtime = SHOWTIME_SUMMARY;
else if (showtimeMode == "top5") else if (showtimeMode == "top5")
_settings->_showtime = SHOWTIME_TOP5; _settings->showtime = SHOWTIME_TOP5;
else if (showtimeMode.empty()) else if (showtimeMode.empty())
_settings->_showtime = SHOWTIME_NONE; _settings->showtime = SHOWTIME_NONE;
else { else {
std::string message("cppcheck: error: unrecognized showtime mode: \""); std::string message("cppcheck: error: unrecognized showtime mode: \"");
message += showtimeMode; message += showtimeMode;
@ -694,15 +694,15 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
// Set maximum number of #ifdef configurations to check // Set maximum number of #ifdef configurations to check
else if (std::strncmp(argv[i], "--max-configs=", 14) == 0) { else if (std::strncmp(argv[i], "--max-configs=", 14) == 0) {
_settings->_force = false; _settings->force = false;
std::istringstream iss(14+argv[i]); std::istringstream iss(14+argv[i]);
if (!(iss >> _settings->_maxConfigs)) { if (!(iss >> _settings->maxConfigs)) {
PrintMessage("cppcheck: argument to '--max-configs=' is not a number."); PrintMessage("cppcheck: argument to '--max-configs=' is not a number.");
return false; return false;
} }
if (_settings->_maxConfigs < 1) { if (_settings->maxConfigs < 1) {
PrintMessage("cppcheck: argument to '--max-configs=' must be greater than 0."); PrintMessage("cppcheck: argument to '--max-configs=' must be greater than 0.");
return false; return false;
} }
@ -734,17 +734,17 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
} }
} }
if (_settings->_force) if (_settings->force)
_settings->_maxConfigs = ~0U; _settings->maxConfigs = ~0U;
else if ((def || _settings->preprocessOnly) && !maxconfigs) else if ((def || _settings->preprocessOnly) && !maxconfigs)
_settings->_maxConfigs = 1U; _settings->maxConfigs = 1U;
if (_settings->isEnabled("unusedFunction") && _settings->_jobs > 1) { if (_settings->isEnabled("unusedFunction") && _settings->jobs > 1) {
PrintMessage("cppcheck: unusedFunction check can't be used with '-j' option. Disabling unusedFunction check."); PrintMessage("cppcheck: unusedFunction check can't be used with '-j' option. Disabling unusedFunction check.");
} }
if (_settings->inconclusive && _settings->_xml && _settings->_xml_version == 1U) { if (_settings->inconclusive && _settings->xml && _settings->xml_version == 1U) {
PrintMessage("cppcheck: inconclusive messages will not be shown, because the old xml format is not compatible. It's recommended to use the new xml format (use --xml-version=2)."); PrintMessage("cppcheck: inconclusive messages will not be shown, because the old xml format is not compatible. It's recommended to use the new xml format (use --xml-version=2).");
} }
@ -765,8 +765,8 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
} }
// Use paths _pathnames if no base paths for relative path output are given // Use paths _pathnames if no base paths for relative path output are given
if (_settings->_basePaths.empty() && _settings->_relativePaths) if (_settings->basePaths.empty() && _settings->relativePaths)
_settings->_basePaths = _pathnames; _settings->basePaths = _pathnames;
return true; return true;
} }

View File

@ -94,9 +94,9 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
if (parser.GetShowErrorMessages()) { if (parser.GetShowErrorMessages()) {
errorlist = true; errorlist = true;
std::cout << ErrorLogger::ErrorMessage::getXMLHeader(settings._xml_version); std::cout << ErrorLogger::ErrorMessage::getXMLHeader(settings.xml_version);
cppcheck->getErrorMessages(); cppcheck->getErrorMessages();
std::cout << ErrorLogger::ErrorMessage::getXMLFooter(settings._xml_version) << std::endl; std::cout << ErrorLogger::ErrorMessage::getXMLFooter(settings.xml_version) << std::endl;
} }
if (parser.ExitAfterPrinting()) { if (parser.ExitAfterPrinting()) {
@ -110,8 +110,8 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
// Check that all include paths exist // Check that all include paths exist
{ {
std::list<std::string>::iterator iter; std::list<std::string>::iterator iter;
for (iter = settings._includePaths.begin(); for (iter = settings.includePaths.begin();
iter != settings._includePaths.end(); iter != settings.includePaths.end();
) { ) {
const std::string path(Path::toNativeSeparators(*iter)); const std::string path(Path::toNativeSeparators(*iter));
if (FileLister::isDirectory(path)) if (FileLister::isDirectory(path))
@ -119,7 +119,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
else { else {
// If the include path is not found, warn user and remove the non-existing path from the list. // If the include path is not found, warn user and remove the non-existing path from the list.
std::cout << "cppcheck: warning: Couldn't find path given by -I '" << path << '\'' << std::endl; std::cout << "cppcheck: warning: Couldn't find path given by -I '" << path << '\'' << std::endl;
iter = settings._includePaths.erase(iter); iter = settings.includePaths.erase(iter);
} }
} }
} }
@ -800,12 +800,12 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
if (settings.reportProgress) if (settings.reportProgress)
time1 = std::time(0); time1 = std::time(0);
if (settings._xml) { if (settings.xml) {
reportErr(ErrorLogger::ErrorMessage::getXMLHeader(settings._xml_version)); reportErr(ErrorLogger::ErrorMessage::getXMLHeader(settings.xml_version));
} }
unsigned int returnValue = 0; unsigned int returnValue = 0;
if (settings._jobs == 1) { if (settings.jobs == 1) {
// Single process // Single process
settings.jointSuppressionReport = true; settings.jointSuppressionReport = true;
@ -878,13 +878,13 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
} }
} }
if (settings._xml) { if (settings.xml) {
reportErr(ErrorLogger::ErrorMessage::getXMLFooter(settings._xml_version)); reportErr(ErrorLogger::ErrorMessage::getXMLFooter(settings.xml_version));
} }
_settings = 0; _settings = 0;
if (returnValue) if (returnValue)
return settings._exitCode; return settings.exitCode;
else else
return 0; return 0;
} }
@ -947,11 +947,11 @@ void CppCheckExecutor::reportStatus(std::size_t fileindex, std::size_t filecount
void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg) void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
{ {
if (errorlist) { if (errorlist) {
reportOut(msg.toXML(false, _settings->_xml_version)); reportOut(msg.toXML(false, _settings->xml_version));
} else if (_settings->_xml) { } else if (_settings->xml) {
reportErr(msg.toXML(_settings->_verbose, _settings->_xml_version)); reportErr(msg.toXML(_settings->verbose, _settings->xml_version));
} else { } else {
reportErr(msg.toString(_settings->_verbose, _settings->_outputFormat)); reportErr(msg.toString(_settings->verbose, _settings->outputFormat));
} }
} }

View File

@ -119,7 +119,7 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
if (!_settings.nomsg.isSuppressed(msg._id, file, line)) { if (!_settings.nomsg.isSuppressed(msg._id, file, line)) {
// Alert only about unique errors // Alert only about unique errors
std::string errmsg = msg.toString(_settings._verbose); std::string errmsg = msg.toString(_settings.verbose);
if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) { if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) {
_errorList.push_back(errmsg); _errorList.push_back(errmsg);
if (type == REPORT_ERROR) if (type == REPORT_ERROR)
@ -146,7 +146,7 @@ bool ThreadExecutor::checkLoadAverage(size_t nchildren)
#if defined(__CYGWIN__) || defined(__QNX__) // getloadavg() is unsupported on Cygwin, Qnx. #if defined(__CYGWIN__) || defined(__QNX__) // getloadavg() is unsupported on Cygwin, Qnx.
return true; return true;
#else #else
if (!nchildren || !_settings._loadAverage) { if (!nchildren || !_settings.loadAverage) {
return true; return true;
} }
@ -154,7 +154,7 @@ bool ThreadExecutor::checkLoadAverage(size_t nchildren)
if (getloadavg(&sample, 1) != 1) { if (getloadavg(&sample, 1) != 1) {
// disable load average checking on getloadavg error // disable load average checking on getloadavg error
return true; return true;
} else if (sample < _settings._loadAverage) { } else if (sample < _settings.loadAverage) {
return true; return true;
} }
return false; return false;
@ -179,7 +179,7 @@ unsigned int ThreadExecutor::check()
for (;;) { for (;;) {
// Start a new child // Start a new child
size_t nchildren = rpipes.size(); size_t nchildren = rpipes.size();
if (i != _files.end() && nchildren < _settings._jobs && checkLoadAverage(nchildren)) { if (i != _files.end() && nchildren < _settings.jobs && checkLoadAverage(nchildren)) {
int pipes[2]; int pipes[2];
if (pipe(pipes) == -1) { if (pipe(pipes) == -1) {
std::cerr << "pipe() failed: "<< std::strerror(errno) << std::endl; std::cerr << "pipe() failed: "<< std::strerror(errno) << std::endl;
@ -348,7 +348,7 @@ void ThreadExecutor::addFileContent(const std::string &path, const std::string &
unsigned int ThreadExecutor::check() unsigned int ThreadExecutor::check()
{ {
HANDLE *threadHandles = new HANDLE[_settings._jobs]; HANDLE *threadHandles = new HANDLE[_settings.jobs];
_itNextFile = _files.begin(); _itNextFile = _files.begin();
@ -364,7 +364,7 @@ unsigned int ThreadExecutor::check()
InitializeCriticalSection(&_errorSync); InitializeCriticalSection(&_errorSync);
InitializeCriticalSection(&_reportSync); InitializeCriticalSection(&_reportSync);
for (unsigned int i = 0; i < _settings._jobs; ++i) { for (unsigned int i = 0; i < _settings.jobs; ++i) {
threadHandles[i] = (HANDLE)_beginthreadex(nullptr, 0, threadProc, this, 0, nullptr); threadHandles[i] = (HANDLE)_beginthreadex(nullptr, 0, threadProc, this, 0, nullptr);
if (!threadHandles[i]) { if (!threadHandles[i]) {
std::cerr << "#### .\nThreadExecutor::check error, errno :" << errno << std::endl; std::cerr << "#### .\nThreadExecutor::check error, errno :" << errno << std::endl;
@ -372,7 +372,7 @@ unsigned int ThreadExecutor::check()
} }
} }
DWORD waitResult = WaitForMultipleObjects(_settings._jobs, threadHandles, TRUE, INFINITE); DWORD waitResult = WaitForMultipleObjects(_settings.jobs, threadHandles, TRUE, INFINITE);
if (waitResult != WAIT_OBJECT_0) { if (waitResult != WAIT_OBJECT_0) {
if (waitResult == WAIT_FAILED) { if (waitResult == WAIT_FAILED) {
std::cerr << "#### .\nThreadExecutor::check wait failed, result: " << waitResult << " error: " << GetLastError() << std::endl; std::cerr << "#### .\nThreadExecutor::check wait failed, result: " << waitResult << " error: " << GetLastError() << std::endl;
@ -384,7 +384,7 @@ unsigned int ThreadExecutor::check()
} }
unsigned int result = 0; unsigned int result = 0;
for (unsigned int i = 0; i < _settings._jobs; ++i) { for (unsigned int i = 0; i < _settings.jobs; ++i) {
DWORD exitCode; DWORD exitCode;
if (!GetExitCodeThread(threadHandles[i], &exitCode)) { if (!GetExitCodeThread(threadHandles[i], &exitCode)) {
@ -488,7 +488,7 @@ void ThreadExecutor::report(const ErrorLogger::ErrorMessage &msg, MessageType ms
// Alert only about unique errors // Alert only about unique errors
bool reportError = false; bool reportError = false;
std::string errmsg = msg.toString(_settings._verbose); std::string errmsg = msg.toString(_settings.verbose);
EnterCriticalSection(&_errorSync); EnterCriticalSection(&_errorSync);
if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) { if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) {

View File

@ -546,7 +546,7 @@ void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result
// include paths must end with '/' // include paths must end with '/'
if (!incdir.endsWith("/")) if (!incdir.endsWith("/"))
incdir += "/"; incdir += "/";
result._includePaths.push_back(incdir.toStdString()); result.includePaths.push_back(incdir.toStdString());
} }
} }
@ -667,7 +667,7 @@ Settings MainWindow::GetCppcheckSettings()
// Only check the given -D configuration // Only check the given -D configuration
if (!defines.isEmpty()) if (!defines.isEmpty())
result._maxConfigs = 1; result.maxConfigs = 1;
} }
// Include directories (and files) are searched in listed order. // Include directories (and files) are searched in listed order.
@ -688,11 +688,11 @@ Settings MainWindow::GetCppcheckSettings()
result.debug = false; result.debug = false;
result.debugwarnings = mSettings->value(SETTINGS_SHOW_DEBUG_WARNINGS, false).toBool(); result.debugwarnings = mSettings->value(SETTINGS_SHOW_DEBUG_WARNINGS, false).toBool();
result.quiet = false; result.quiet = false;
result._verbose = true; result.verbose = true;
result._force = mSettings->value(SETTINGS_CHECK_FORCE, 1).toBool(); result.force = mSettings->value(SETTINGS_CHECK_FORCE, 1).toBool();
result._xml = false; result.xml = false;
result._jobs = mSettings->value(SETTINGS_CHECK_THREADS, 1).toInt(); result.jobs = mSettings->value(SETTINGS_CHECK_THREADS, 1).toInt();
result._inlineSuppressions = mSettings->value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool(); result.inlineSuppressions = mSettings->value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool();
result.inconclusive = mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool(); result.inconclusive = mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool();
result.platformType = (Settings::PlatformType) mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt(); result.platformType = (Settings::PlatformType) mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt();
result.standards.cpp = mSettings->value(SETTINGS_STD_CPP11, true).toBool() ? Standards::CPP11 : Standards::CPP03; result.standards.cpp = mSettings->value(SETTINGS_STD_CPP11, true).toBool() ? Standards::CPP11 : Standards::CPP03;
@ -711,8 +711,8 @@ Settings MainWindow::GetCppcheckSettings()
if (!std || !posix || !windows) if (!std || !posix || !windows)
QMessageBox::critical(this, tr("Error"), tr("Failed to load %1. Your Cppcheck installation is broken. You can use --data-dir=<directory> at the command line to specify where this file is located.").arg(!std ? "std.cfg" : !posix ? "posix.cfg" : "windows.cfg")); QMessageBox::critical(this, tr("Error"), tr("Failed to load %1. Your Cppcheck installation is broken. You can use --data-dir=<directory> at the command line to specify where this file is located.").arg(!std ? "std.cfg" : !posix ? "posix.cfg" : "windows.cfg"));
if (result._jobs <= 1) { if (result.jobs <= 1) {
result._jobs = 1; result.jobs = 1;
} }
return result; return result;

View File

@ -67,13 +67,13 @@ void ThreadHandler::SetCheckFiles(QStringList files)
void ThreadHandler::Check(const Settings &settings, bool all) void ThreadHandler::Check(const Settings &settings, bool all)
{ {
if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings._jobs == 0) { if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings.jobs == 0) {
qDebug() << "Can't start checking if there's no files to check or if check is in progress."; qDebug() << "Can't start checking if there's no files to check or if check is in progress.";
emit Done(); emit Done();
return; return;
} }
SetThreadCount(settings._jobs); SetThreadCount(settings.jobs);
mRunningThreadCount = mThreads.size(); mRunningThreadCount = mThreads.size();

View File

@ -2017,7 +2017,7 @@ void CheckMemoryLeakInFunction::checkScope(const Token *startTok, const std::str
simplifycode(tok); simplifycode(tok);
if (_settings->debug && _settings->_verbose) { if (_settings->debug && _settings->verbose) {
tok->printOut(("Checkmemoryleak: simplifycode result for: " + varname).c_str()); tok->printOut(("Checkmemoryleak: simplifycode result for: " + varname).c_str());
} }

View File

@ -259,7 +259,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger * const errorLogger,
Check::FileInfo *CheckUnusedFunctions::getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const Check::FileInfo *CheckUnusedFunctions::getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const
{ {
if (settings->isEnabled("unusedFunction") && settings->_jobs == 1) if (settings->isEnabled("unusedFunction") && settings->jobs == 1)
instance.parseTokens(*tokenizer, tokenizer->list.getFiles().front().c_str(), settings); instance.parseTokens(*tokenizer, tokenizer->list.getFiles().front().c_str(), settings);
return nullptr; return nullptr;

View File

@ -51,7 +51,7 @@ CppCheck::~CppCheck()
delete fileInfo.back(); delete fileInfo.back();
fileInfo.pop_back(); fileInfo.pop_back();
} }
S_timerResults.ShowResults(_settings._showtime); S_timerResults.ShowResults(_settings.showtime);
} }
const char * CppCheck::version() const char * CppCheck::version()
@ -100,8 +100,8 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
std::string filedata; std::string filedata;
{ {
Timer t("Preprocessor::preprocess", _settings._showtime, &S_timerResults); Timer t("Preprocessor::preprocess", _settings.showtime, &S_timerResults);
preprocessor.preprocess(fileStream, filedata, configurations, filename, _settings._includePaths); preprocessor.preprocess(fileStream, filedata, configurations, filename, _settings.includePaths);
} }
if (_settings.checkConfiguration) { if (_settings.checkConfiguration) {
@ -130,12 +130,12 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
} }
} }
if (!_settings.userDefines.empty() && _settings._maxConfigs==1U) { if (!_settings.userDefines.empty() && _settings.maxConfigs==1U) {
configurations.clear(); configurations.clear();
configurations.push_back(_settings.userDefines); configurations.push_back(_settings.userDefines);
} }
if (!_settings._force && configurations.size() > _settings._maxConfigs) { if (!_settings.force && configurations.size() > _settings.maxConfigs) {
if (_settings.isEnabled("information")) { if (_settings.isEnabled("information")) {
tooManyConfigsError(Path::toNativeSeparators(filename),configurations.size()); tooManyConfigsError(Path::toNativeSeparators(filename),configurations.size());
} else { } else {
@ -163,7 +163,7 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
// Check only a few configurations (default 12), after that bail out, unless --force // Check only a few configurations (default 12), after that bail out, unless --force
// was used. // was used.
if (!_settings._force && ++checkCount > _settings._maxConfigs) if (!_settings.force && ++checkCount > _settings.maxConfigs)
break; break;
cfg = *it; cfg = *it;
@ -181,7 +181,7 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
cfg = _settings.userDefines + cfg; cfg = _settings.userDefines + cfg;
} }
Timer t("Preprocessor::getcode", _settings._showtime, &S_timerResults); Timer t("Preprocessor::getcode", _settings.showtime, &S_timerResults);
std::string codeWithoutCfg = preprocessor.getcode(filedata, cfg, filename); std::string codeWithoutCfg = preprocessor.getcode(filedata, cfg, filename);
t.Stop(); t.Stop();
@ -204,13 +204,13 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
} }
Tokenizer _tokenizer(&_settings, this); Tokenizer _tokenizer(&_settings, this);
if (_settings._showtime != SHOWTIME_NONE) if (_settings.showtime != SHOWTIME_NONE)
_tokenizer.setTimerResults(&S_timerResults); _tokenizer.setTimerResults(&S_timerResults);
try { try {
// Create tokens, skip rest of iteration if failed // Create tokens, skip rest of iteration if failed
std::istringstream istr(codeWithoutCfg); std::istringstream istr(codeWithoutCfg);
Timer timer("Tokenizer::createTokens", _settings._showtime, &S_timerResults); Timer timer("Tokenizer::createTokens", _settings.showtime, &S_timerResults);
bool result = _tokenizer.createTokens(istr, filename.c_str()); bool result = _tokenizer.createTokens(istr, filename.c_str());
timer.Stop(); timer.Stop();
if (!result) if (!result)
@ -224,7 +224,7 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
checkRawTokens(_tokenizer); checkRawTokens(_tokenizer);
// Simplify tokens into normal form, skip rest of iteration if failed // Simplify tokens into normal form, skip rest of iteration if failed
Timer timer2("Tokenizer::simplifyTokens1", _settings._showtime, &S_timerResults); Timer timer2("Tokenizer::simplifyTokens1", _settings.showtime, &S_timerResults);
result = _tokenizer.simplifyTokens1(cfg); result = _tokenizer.simplifyTokens1(cfg);
timer2.Stop(); timer2.Stop();
if (!result) if (!result)
@ -238,7 +238,7 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
} }
// Skip if we already met the same simplified token list // Skip if we already met the same simplified token list
if (_settings._force || _settings._maxConfigs > 1) { if (_settings.force || _settings.maxConfigs > 1) {
const unsigned long long checksum = _tokenizer.list.calculateChecksum(); const unsigned long long checksum = _tokenizer.list.calculateChecksum();
if (checksums.find(checksum) != checksums.end()) if (checksums.find(checksum) != checksums.end())
continue; continue;
@ -251,7 +251,7 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
// simplify more if required, skip rest of iteration if failed // simplify more if required, skip rest of iteration if failed
if (_simplify) { if (_simplify) {
// if further simplification fails then skip rest of iteration // if further simplification fails then skip rest of iteration
Timer timer3("Tokenizer::simplifyTokenList2", _settings._showtime, &S_timerResults); Timer timer3("Tokenizer::simplifyTokenList2", _settings.showtime, &S_timerResults);
result = _tokenizer.simplifyTokenList2(); result = _tokenizer.simplifyTokenList2();
timer3.Stop(); timer3.Stop();
if (!result) if (!result)
@ -262,7 +262,7 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
} }
} catch (const InternalError &e) { } catch (const InternalError &e) {
if (_settings.isEnabled("information") && (_settings.debug || _settings._verbose)) if (_settings.isEnabled("information") && (_settings.debug || _settings.verbose))
purgedConfigurationMessage(filename, cfg); purgedConfigurationMessage(filename, cfg);
internalErrorFound=true; internalErrorFound=true;
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList; std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
@ -356,7 +356,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
if (_settings.terminated()) if (_settings.terminated())
return; return;
Timer timerRunChecks((*it)->name() + "::runChecks", _settings._showtime, &S_timerResults); Timer timerRunChecks((*it)->name() + "::runChecks", _settings.showtime, &S_timerResults);
(*it)->runChecks(&tokenizer, &_settings, this); (*it)->runChecks(&tokenizer, &_settings, this);
} }
@ -381,7 +381,7 @@ void CppCheck::checkSimplifiedTokens(const Tokenizer &tokenizer)
if (_settings.terminated()) if (_settings.terminated())
return; return;
Timer timerSimpleChecks((*it)->name() + "::runSimplifiedChecks", _settings._showtime, &S_timerResults); Timer timerSimpleChecks((*it)->name() + "::runSimplifiedChecks", _settings.showtime, &S_timerResults);
(*it)->runSimplifiedChecks(&tokenizer, &_settings, this); (*it)->runSimplifiedChecks(&tokenizer, &_settings, this);
timerSimpleChecks.Stop(); timerSimpleChecks.Stop();
} }
@ -500,8 +500,8 @@ void CppCheck::tooManyConfigsError(const std::string &file, const std::size_t nu
} }
std::ostringstream msg; std::ostringstream msg;
msg << "Too many #ifdef configurations - cppcheck only checks " << _settings._maxConfigs; msg << "Too many #ifdef configurations - cppcheck only checks " << _settings.maxConfigs;
if (numberOfConfigurations > _settings._maxConfigs) if (numberOfConfigurations > _settings.maxConfigs)
msg << " of " << numberOfConfigurations << " configurations. Use --force to check all configurations.\n"; msg << " of " << numberOfConfigurations << " configurations. Use --force to check all configurations.\n";
if (file.empty()) if (file.empty())
msg << " configurations. Use --force to check all configurations. For more details, use --enable=information.\n"; msg << " configurations. Use --force to check all configurations. For more details, use --enable=information.\n";
@ -553,7 +553,7 @@ void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg)
if (!_settings.library.reportErrors(msg.file0)) if (!_settings.library.reportErrors(msg.file0))
return; return;
const std::string errmsg = msg.toString(_settings._verbose); const std::string errmsg = msg.toString(_settings.verbose);
if (errmsg.empty()) if (errmsg.empty())
return; return;
@ -648,5 +648,5 @@ void CppCheck::analyseWholeProgram()
bool CppCheck::unusedFunctionCheckIsEnabled() const bool CppCheck::unusedFunctionCheckIsEnabled() const
{ {
return (_settings._jobs == 1 && _settings.isEnabled("unusedFunction")); return (_settings.jobs == 1 && _settings.isEnabled("unusedFunction"));
} }

View File

@ -535,7 +535,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
break; break;
std::string comment(str, commentStart, i - commentStart); std::string comment(str, commentStart, i - commentStart);
if (_settings._inlineSuppressions) { if (_settings.inlineSuppressions) {
std::istringstream iss(comment); std::istringstream iss(comment);
std::string word; std::string word;
iss >> word; iss >> word;
@ -572,7 +572,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
fallThroughComment = true; fallThroughComment = true;
} }
if (_settings._inlineSuppressions) { if (_settings.inlineSuppressions) {
std::istringstream iss(comment); std::istringstream iss(comment);
std::string word; std::string word;
iss >> word; iss >> word;
@ -641,9 +641,9 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
if (!suppressionIDs.empty()) { if (!suppressionIDs.empty()) {
// Relative filename // Relative filename
std::string relativeFilename(filename); std::string relativeFilename(filename);
if (_settings._relativePaths) { if (_settings.relativePaths) {
for (std::size_t j = 0U; j < _settings._basePaths.size(); ++j) { for (std::size_t j = 0U; j < _settings.basePaths.size(); ++j) {
const std::string bp = _settings._basePaths[j] + "/"; const std::string bp = _settings.basePaths[j] + "/";
if (relativeFilename.compare(0,bp.size(),bp)==0) { if (relativeFilename.compare(0,bp.size(),bp)==0) {
relativeFilename = relativeFilename.substr(bp.size()); relativeFilename = relativeFilename.substr(bp.size());
} }
@ -1036,7 +1036,7 @@ void Preprocessor::preprocess(std::istream &srcCodeStream, std::string &processe
std::map<std::string, std::string> defs(getcfgmap(_settings.userDefines, &_settings, filename)); std::map<std::string, std::string> defs(getcfgmap(_settings.userDefines, &_settings, filename));
if (_settings._maxConfigs == 1U) { if (_settings.maxConfigs == 1U) {
std::set<std::string> pragmaOnce; std::set<std::string> pragmaOnce;
std::list<std::string> includes; std::list<std::string> includes;
processedFile = handleIncludes(processedFile, filename, includePaths, defs, pragmaOnce, includes); processedFile = handleIncludes(processedFile, filename, includePaths, defs, pragmaOnce, includes);
@ -1917,7 +1917,7 @@ std::string Preprocessor::getcode(const std::string &filedata, const std::string
// #error => return "" // #error => return ""
if (match && line.compare(0, 6, "#error") == 0) { if (match && line.compare(0, 6, "#error") == 0) {
if (!_settings.userDefines.empty() && !_settings._force) { if (!_settings.userDefines.empty() && !_settings.force) {
error(Path::simplifyPath(filenames.top()), lineno, line); error(Path::simplifyPath(filenames.top()), lineno, line);
} }
return ""; return "";

View File

@ -24,7 +24,7 @@
#include <set> #include <set>
Settings::Settings() Settings::Settings()
: _terminate(false), : _terminated(false),
debug(false), debug(false),
debugnormal(false), debugnormal(false),
debugwarnings(false), debugwarnings(false),
@ -34,17 +34,17 @@ Settings::Settings()
jointSuppressionReport(false), jointSuppressionReport(false),
experimental(false), experimental(false),
quiet(false), quiet(false),
_inlineSuppressions(false), inlineSuppressions(false),
_verbose(false), verbose(false),
_force(false), force(false),
_relativePaths(false), relativePaths(false),
_xml(false), _xml_version(1), xml(false), xml_version(1),
_jobs(1), jobs(1),
_loadAverage(0), loadAverage(0),
_exitCode(0), exitCode(0),
_showtime(SHOWTIME_NONE), showtime(SHOWTIME_NONE),
preprocessOnly(false), preprocessOnly(false),
_maxConfigs(12), maxConfigs(12),
enforcedLang(None), enforcedLang(None),
reportProgress(false), reportProgress(false),
checkConfiguration(false), checkConfiguration(false),

View File

@ -50,7 +50,7 @@ private:
std::set<std::string> _enabled; std::set<std::string> _enabled;
/** @brief terminate checking */ /** @brief terminate checking */
bool _terminate; bool _terminated;
public: public:
Settings(); Settings();
@ -90,60 +90,60 @@ public:
bool quiet; bool quiet;
/** @brief Is --inline-suppr given? */ /** @brief Is --inline-suppr given? */
bool _inlineSuppressions; bool inlineSuppressions;
/** @brief Is --verbose given? */ /** @brief Is --verbose given? */
bool _verbose; bool verbose;
/** @brief Request termination of checking */ /** @brief Request termination of checking */
void terminate() { void terminate() {
_terminate = true; _terminated = true;
} }
/** @brief termination requested? */ /** @brief termination requested? */
bool terminated() const { bool terminated() const {
return _terminate; return _terminated;
} }
/** @brief Force checking the files with "too many" configurations (--force). */ /** @brief Force checking the files with "too many" configurations (--force). */
bool _force; bool force;
/** @brief Use relative paths in output. */ /** @brief Use relative paths in output. */
bool _relativePaths; bool relativePaths;
/** @brief Paths used as base for conversion to relative paths. */ /** @brief Paths used as base for conversion to relative paths. */
std::vector<std::string> _basePaths; std::vector<std::string> basePaths;
/** @brief write XML results (--xml) */ /** @brief write XML results (--xml) */
bool _xml; bool xml;
/** @brief XML version (--xmlver=..) */ /** @brief XML version (--xmlver=..) */
int _xml_version; int xml_version;
/** @brief How many processes/threads should do checking at the same /** @brief How many processes/threads should do checking at the same
time. Default is 1. (-j N) */ time. Default is 1. (-j N) */
unsigned int _jobs; unsigned int jobs;
/** @brief Load average value */ /** @brief Load average value */
unsigned int _loadAverage; unsigned int loadAverage;
/** @brief If errors are found, this value is returned from main(). /** @brief If errors are found, this value is returned from main().
Default value is 0. */ Default value is 0. */
int _exitCode; int exitCode;
/** @brief The output format in which the errors are printed in text mode, /** @brief The output format in which the errors are printed in text mode,
e.g. "{severity} {file}:{line} {message} {id}" */ e.g. "{severity} {file}:{line} {message} {id}" */
std::string _outputFormat; std::string outputFormat;
/** @brief show timing information (--showtime=file|summary|top5) */ /** @brief show timing information (--showtime=file|summary|top5) */
SHOWTIME_MODES _showtime; SHOWTIME_MODES showtime;
/** @brief Using -E for debugging purposes */ /** @brief Using -E for debugging purposes */
bool preprocessOnly; bool preprocessOnly;
/** @brief List of include paths, e.g. "my/includes/" which should be used /** @brief List of include paths, e.g. "my/includes/" which should be used
for finding include files inside source files. (-I) */ for finding include files inside source files. (-I) */
std::list<std::string> _includePaths; std::list<std::string> includePaths;
/** @brief assign append code (--append) */ /** @brief assign append code (--append) */
bool append(const std::string &filename); bool append(const std::string &filename);
@ -153,7 +153,7 @@ public:
/** @brief Maximum number of configurations to check before bailing. /** @brief Maximum number of configurations to check before bailing.
Default is 12. (--max-configs=N) */ Default is 12. (--max-configs=N) */
unsigned int _maxConfigs; unsigned int maxConfigs;
/** /**
* @brief Returns true if given id is in the list of * @brief Returns true if given id is in the list of
@ -299,7 +299,6 @@ public:
} }
return false; return false;
} }
}; };
/// @} /// @}

View File

@ -1698,7 +1698,7 @@ bool Tokenizer::createTokens(std::istream &code,
// make sure settings specified // make sure settings specified
assert(_settings); assert(_settings);
return list.createTokens(code, Path::getRelativePath(Path::simplifyPath(FileName), _settings->_basePaths)); return list.createTokens(code, Path::getRelativePath(Path::simplifyPath(FileName), _settings->basePaths));
} }
bool Tokenizer::simplifyTokens1(const std::string &configuration, bool Tokenizer::simplifyTokens1(const std::string &configuration,
@ -3523,7 +3523,7 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
// typedef.. // typedef..
if (m_timerResults) { if (m_timerResults) {
Timer t("Tokenizer::tokenize::simplifyTypedef", _settings->_showtime, m_timerResults); Timer t("Tokenizer::tokenize::simplifyTypedef", _settings->showtime, m_timerResults);
simplifyTypedef(); simplifyTypedef();
} else { } else {
simplifyTypedef(); simplifyTypedef();
@ -3638,7 +3638,7 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
validate(); // #6772 "segmentation fault (invalid code) in Tokenizer::setVarId" validate(); // #6772 "segmentation fault (invalid code) in Tokenizer::setVarId"
if (m_timerResults) { if (m_timerResults) {
Timer t("Tokenizer::tokenize::setVarId", _settings->_showtime, m_timerResults); Timer t("Tokenizer::tokenize::setVarId", _settings->showtime, m_timerResults);
setVarId(); setVarId();
} else { } else {
setVarId(); setVarId();
@ -3846,22 +3846,22 @@ void Tokenizer::printDebugOutput(unsigned int simplification) const
if (debug && list.front()) { if (debug && list.front()) {
list.front()->printOut(0, list.getFiles()); list.front()->printOut(0, list.getFiles());
if (_settings->_xml) if (_settings->xml)
std::cout << "<debug>" << std::endl; std::cout << "<debug>" << std::endl;
if (_symbolDatabase) { if (_symbolDatabase) {
if (_settings->_xml) if (_settings->xml)
_symbolDatabase->printXml(std::cout); _symbolDatabase->printXml(std::cout);
else if (_settings->_verbose) else if (_settings->verbose)
_symbolDatabase->printOut("Symbol database"); _symbolDatabase->printOut("Symbol database");
} }
if (_settings->_verbose) if (_settings->verbose)
list.front()->printAst(_settings->_verbose, _settings->_xml, std::cout); list.front()->printAst(_settings->verbose, _settings->xml, std::cout);
list.front()->printValueFlow(_settings->_xml, std::cout); list.front()->printValueFlow(_settings->xml, std::cout);
if (_settings->_xml) if (_settings->xml)
std::cout << "</debug>" << std::endl; std::cout << "</debug>" << std::endl;
} }

View File

@ -396,7 +396,7 @@ bool TokenList::createTokens(std::istream &code, const std::string& file0)
Token::assignProgressValues(_front); Token::assignProgressValues(_front);
for (std::size_t i = 1; i < _files.size(); i++) for (std::size_t i = 1; i < _files.size(); i++)
_files[i] = Path::getRelativePath(_files[i], _settings->_basePaths); _files[i] = Path::getRelativePath(_files[i], _settings->basePaths);
return true; return true;
} }

View File

@ -204,17 +204,17 @@ private:
void verboseshort() { void verboseshort() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-v", "file.cpp"}; const char *argv[] = {"cppcheck", "-v", "file.cpp"};
settings._verbose = false; settings.verbose = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS(true, settings._verbose); ASSERT_EQUALS(true, settings.verbose);
} }
void verboselong() { void verboselong() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--verbose", "file.cpp"}; const char *argv[] = {"cppcheck", "--verbose", "file.cpp"};
settings._verbose = false; settings.verbose = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS(true, settings._verbose); ASSERT_EQUALS(true, settings.verbose);
} }
void debug() { void debug() {
@ -236,52 +236,52 @@ private:
void forceshort() { void forceshort() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-f", "file.cpp"}; const char *argv[] = {"cppcheck", "-f", "file.cpp"};
settings._force = false; settings.force = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS(true, settings._force); ASSERT_EQUALS(true, settings.force);
} }
void forcelong() { void forcelong() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--force", "file.cpp"}; const char *argv[] = {"cppcheck", "--force", "file.cpp"};
settings._force = false; settings.force = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS(true, settings._force); ASSERT_EQUALS(true, settings.force);
} }
void relativePaths() { void relativePaths() {
REDIRECT; REDIRECT;
settings._relativePaths = false; settings.relativePaths = false;
const char *argvs[] = {"cppcheck", "-rp", "file.cpp"}; const char *argvs[] = {"cppcheck", "-rp", "file.cpp"};
ASSERT(defParser.ParseFromArgs(3, argvs)); ASSERT(defParser.ParseFromArgs(3, argvs));
ASSERT_EQUALS(true, settings._relativePaths); ASSERT_EQUALS(true, settings.relativePaths);
settings._relativePaths = false; settings.relativePaths = false;
const char *argvl[] = {"cppcheck", "--relative-paths", "file.cpp"}; const char *argvl[] = {"cppcheck", "--relative-paths", "file.cpp"};
ASSERT(defParser.ParseFromArgs(3, argvl)); ASSERT(defParser.ParseFromArgs(3, argvl));
ASSERT_EQUALS(true, settings._relativePaths); ASSERT_EQUALS(true, settings.relativePaths);
settings._relativePaths = false; settings.relativePaths = false;
settings._basePaths.clear(); settings.basePaths.clear();
const char *argvsp[] = {"cppcheck", "-rp=C:/foo;C:\\bar", "file.cpp"}; const char *argvsp[] = {"cppcheck", "-rp=C:/foo;C:\\bar", "file.cpp"};
ASSERT(defParser.ParseFromArgs(3, argvsp)); ASSERT(defParser.ParseFromArgs(3, argvsp));
ASSERT_EQUALS(true, settings._relativePaths); ASSERT_EQUALS(true, settings.relativePaths);
ASSERT_EQUALS(2, settings._basePaths.size()); ASSERT_EQUALS(2, settings.basePaths.size());
ASSERT_EQUALS("C:/foo", settings._basePaths[0]); ASSERT_EQUALS("C:/foo", settings.basePaths[0]);
ASSERT_EQUALS("C:/bar", settings._basePaths[1]); ASSERT_EQUALS("C:/bar", settings.basePaths[1]);
settings._relativePaths = false; settings.relativePaths = false;
settings._basePaths.clear(); settings.basePaths.clear();
const char *argvlp[] = {"cppcheck", "--relative-paths=C:/foo;C:\\bar", "file.cpp"}; const char *argvlp[] = {"cppcheck", "--relative-paths=C:/foo;C:\\bar", "file.cpp"};
ASSERT(defParser.ParseFromArgs(3, argvlp)); ASSERT(defParser.ParseFromArgs(3, argvlp));
ASSERT_EQUALS(true, settings._relativePaths); ASSERT_EQUALS(true, settings.relativePaths);
ASSERT_EQUALS(2, settings._basePaths.size()); ASSERT_EQUALS(2, settings.basePaths.size());
ASSERT_EQUALS("C:/foo", settings._basePaths[0]); ASSERT_EQUALS("C:/foo", settings.basePaths[0]);
ASSERT_EQUALS("C:/bar", settings._basePaths[1]); ASSERT_EQUALS("C:/bar", settings.basePaths[1]);
} }
void quietshort() { void quietshort() {
@ -403,50 +403,50 @@ private:
void includes() { void includes() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-I", "include", "file.cpp"}; const char *argv[] = {"cppcheck", "-I", "include", "file.cpp"};
settings._includePaths.clear(); settings.includePaths.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("include/", settings._includePaths.front()); ASSERT_EQUALS("include/", settings.includePaths.front());
} }
void includesslash() { void includesslash() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-I", "include/", "file.cpp"}; const char *argv[] = {"cppcheck", "-I", "include/", "file.cpp"};
settings._includePaths.clear(); settings.includePaths.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("include/", settings._includePaths.front()); ASSERT_EQUALS("include/", settings.includePaths.front());
} }
void includesbackslash() { void includesbackslash() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-I", "include\\", "file.cpp"}; const char *argv[] = {"cppcheck", "-I", "include\\", "file.cpp"};
settings._includePaths.clear(); settings.includePaths.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("include/", settings._includePaths.front()); ASSERT_EQUALS("include/", settings.includePaths.front());
} }
void includesnospace() { void includesnospace() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-Iinclude", "file.cpp"}; const char *argv[] = {"cppcheck", "-Iinclude", "file.cpp"};
settings._includePaths.clear(); settings.includePaths.clear();
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS("include/", settings._includePaths.front()); ASSERT_EQUALS("include/", settings.includePaths.front());
} }
void includes2() { void includes2() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-I", "include/", "-I", "framework/", "file.cpp"}; const char *argv[] = {"cppcheck", "-I", "include/", "-I", "framework/", "file.cpp"};
settings._includePaths.clear(); settings.includePaths.clear();
ASSERT(defParser.ParseFromArgs(6, argv)); ASSERT(defParser.ParseFromArgs(6, argv));
ASSERT_EQUALS("include/", settings._includePaths.front()); ASSERT_EQUALS("include/", settings.includePaths.front());
settings._includePaths.pop_front(); settings.includePaths.pop_front();
ASSERT_EQUALS("framework/", settings._includePaths.front()); ASSERT_EQUALS("framework/", settings.includePaths.front());
} }
void includesFile() { void includesFile() {
// TODO: Fails since cannot open the file // TODO: Fails since cannot open the file
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--includes-file=inclpaths.txt", "file.cpp"}; const char *argv[] = {"cppcheck", "--includes-file=inclpaths.txt", "file.cpp"};
settings._includePaths.clear(); settings.includePaths.clear();
ASSERT_EQUALS(true, defParser.ParseFromArgs(3, argv)); ASSERT_EQUALS(true, defParser.ParseFromArgs(3, argv));
} }
@ -551,15 +551,15 @@ private:
void errorExitcode() { void errorExitcode() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--error-exitcode=5", "file.cpp"}; const char *argv[] = {"cppcheck", "--error-exitcode=5", "file.cpp"};
settings._exitCode = 0; settings.exitCode = 0;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS(5, settings._exitCode); ASSERT_EQUALS(5, settings.exitCode);
} }
void errorExitcodeMissing() { void errorExitcodeMissing() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--error-exitcode=", "file.cpp"}; const char *argv[] = {"cppcheck", "--error-exitcode=", "file.cpp"};
settings._exitCode = 0; settings.exitCode = 0;
// Fails since exit code not given // Fails since exit code not given
ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv));
} }
@ -567,7 +567,7 @@ private:
void errorExitcodeStr() { void errorExitcodeStr() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--error-exitcode=foo", "file.cpp"}; const char *argv[] = {"cppcheck", "--error-exitcode=foo", "file.cpp"};
settings._exitCode = 0; settings.exitCode = 0;
// Fails since invalid exit code // Fails since invalid exit code
ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv));
} }
@ -576,7 +576,7 @@ private:
// TODO: Fails since cannot open the file // TODO: Fails since cannot open the file
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--exitcode-suppressions", "suppr.txt", "file.cpp"}; const char *argv[] = {"cppcheck", "--exitcode-suppressions", "suppr.txt", "file.cpp"};
settings._exitCode = 0; settings.exitCode = 0;
TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(4, argv)); TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(4, argv));
} }
@ -584,7 +584,7 @@ private:
// TODO: Fails since cannot open the file // TODO: Fails since cannot open the file
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--exitcode-suppressions=suppr.txt", "file.cpp"}; const char *argv[] = {"cppcheck", "--exitcode-suppressions=suppr.txt", "file.cpp"};
settings._exitCode = 0; settings.exitCode = 0;
TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv));
} }
@ -592,7 +592,7 @@ private:
// TODO: Fails since cannot open the file // TODO: Fails since cannot open the file
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--exitcode-suppressions", "file.cpp"}; const char *argv[] = {"cppcheck", "--exitcode-suppressions", "file.cpp"};
settings._exitCode = 0; settings.exitCode = 0;
TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv));
} }
@ -620,15 +620,15 @@ private:
void jobs() { void jobs() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-j", "3", "file.cpp"}; const char *argv[] = {"cppcheck", "-j", "3", "file.cpp"};
settings._jobs = 0; settings.jobs = 0;
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS(3, settings._jobs); ASSERT_EQUALS(3, settings.jobs);
} }
void jobsMissingCount() { void jobsMissingCount() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-j", "file.cpp"}; const char *argv[] = {"cppcheck", "-j", "file.cpp"};
settings._jobs = 0; settings.jobs = 0;
// Fails since -j is missing thread count // Fails since -j is missing thread count
ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv));
} }
@ -636,7 +636,7 @@ private:
void jobsInvalid() { void jobsInvalid() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-j", "e", "file.cpp"}; const char *argv[] = {"cppcheck", "-j", "e", "file.cpp"};
settings._jobs = 0; settings.jobs = 0;
// Fails since invalid count given for -j // Fails since invalid count given for -j
ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv));
} }
@ -644,11 +644,11 @@ private:
void maxConfigs() { void maxConfigs() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-f", "--max-configs=12", "file.cpp"}; const char *argv[] = {"cppcheck", "-f", "--max-configs=12", "file.cpp"};
settings._force = false; settings.force = false;
settings._maxConfigs = 12; settings.maxConfigs = 12;
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS(12, settings._maxConfigs); ASSERT_EQUALS(12, settings.maxConfigs);
ASSERT_EQUALS(false, settings._force); ASSERT_EQUALS(false, settings.force);
} }
void maxConfigsMissingCount() { void maxConfigsMissingCount() {
@ -787,83 +787,83 @@ private:
void templates() { void templates() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--template", "{file}:{line},{severity},{id},{message}", "file.cpp"}; const char *argv[] = {"cppcheck", "--template", "{file}:{line},{severity},{id},{message}", "file.cpp"};
settings._outputFormat.clear(); settings.outputFormat.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("{file}:{line},{severity},{id},{message}", settings._outputFormat); ASSERT_EQUALS("{file}:{line},{severity},{id},{message}", settings.outputFormat);
} }
void templatesGcc() { void templatesGcc() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--template", "gcc", "file.cpp"}; const char *argv[] = {"cppcheck", "--template", "gcc", "file.cpp"};
settings._outputFormat.clear(); settings.outputFormat.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("{file}:{line}: {severity}: {message}", settings._outputFormat); ASSERT_EQUALS("{file}:{line}: {severity}: {message}", settings.outputFormat);
} }
void templatesVs() { void templatesVs() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--template", "vs", "file.cpp"}; const char *argv[] = {"cppcheck", "--template", "vs", "file.cpp"};
settings._outputFormat.clear(); settings.outputFormat.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("{file}({line}): {severity}: {message}", settings._outputFormat); ASSERT_EQUALS("{file}({line}): {severity}: {message}", settings.outputFormat);
} }
void templatesEdit() { void templatesEdit() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--template", "edit", "file.cpp"}; const char *argv[] = {"cppcheck", "--template", "edit", "file.cpp"};
settings._outputFormat.clear(); settings.outputFormat.clear();
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT_EQUALS("{file} +{line}: {severity}: {message}", settings._outputFormat); ASSERT_EQUALS("{file} +{line}: {severity}: {message}", settings.outputFormat);
} }
void xml() { void xml() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--xml", "file.cpp"}; const char *argv[] = {"cppcheck", "--xml", "file.cpp"};
settings._xml_version = 1; settings.xml_version = 1;
settings._xml = false; settings.xml = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT(settings._xml); ASSERT(settings.xml);
ASSERT_EQUALS(1, settings._xml_version); ASSERT_EQUALS(1, settings.xml_version);
} }
void xmlver1() { void xmlver1() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--xml-version=1", "file.cpp"}; const char *argv[] = {"cppcheck", "--xml-version=1", "file.cpp"};
settings._xml_version = 1; settings.xml_version = 1;
settings._xml = false; settings.xml = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT(settings._xml); ASSERT(settings.xml);
ASSERT_EQUALS(1, settings._xml_version); ASSERT_EQUALS(1, settings.xml_version);
} }
void xmlver2() { void xmlver2() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--xml-version=2", "file.cpp"}; const char *argv[] = {"cppcheck", "--xml-version=2", "file.cpp"};
settings._xml_version = 1; settings.xml_version = 1;
settings._xml = false; settings.xml = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT(settings._xml); ASSERT(settings.xml);
ASSERT_EQUALS(2, settings._xml_version); ASSERT_EQUALS(2, settings.xml_version);
} }
void xmlver2both() { void xmlver2both() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--xml", "--xml-version=2", "file.cpp"}; const char *argv[] = {"cppcheck", "--xml", "--xml-version=2", "file.cpp"};
settings._xml_version = 1; settings.xml_version = 1;
settings._xml = false; settings.xml = false;
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT(settings._xml); ASSERT(settings.xml);
ASSERT_EQUALS(2, settings._xml_version); ASSERT_EQUALS(2, settings.xml_version);
} }
void xmlver2both2() { void xmlver2both2() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--xml-version=2", "--xml", "file.cpp"}; const char *argv[] = {"cppcheck", "--xml-version=2", "--xml", "file.cpp"};
settings._xml_version = 1; settings.xml_version = 1;
settings._xml = false; settings.xml = false;
ASSERT(defParser.ParseFromArgs(4, argv)); ASSERT(defParser.ParseFromArgs(4, argv));
ASSERT(settings._xml); ASSERT(settings.xml);
ASSERT_EQUALS(2, settings._xml_version); ASSERT_EQUALS(2, settings.xml_version);
} }
void xmlverunknown() { void xmlverunknown() {
@ -890,9 +890,9 @@ private:
void showtime() { void showtime() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--showtime=summary"}; const char *argv[] = {"cppcheck", "--showtime=summary"};
settings._showtime = SHOWTIME_NONE; settings.showtime = SHOWTIME_NONE;
ASSERT(defParser.ParseFromArgs(2, argv)); ASSERT(defParser.ParseFromArgs(2, argv));
ASSERT(settings._showtime == SHOWTIME_SUMMARY); ASSERT(settings.showtime == SHOWTIME_SUMMARY);
} }
void errorlist1() { void errorlist1() {
@ -905,17 +905,17 @@ private:
void errorlistverbose1() { void errorlistverbose1() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--verbose", "--errorlist"}; const char *argv[] = {"cppcheck", "--verbose", "--errorlist"};
settings._verbose = false; settings.verbose = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT(settings._verbose); ASSERT(settings.verbose);
} }
void errorlistverbose2() { void errorlistverbose2() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--errorlist", "--verbose"}; const char *argv[] = {"cppcheck", "--errorlist", "--verbose"};
settings._verbose = false; settings.verbose = false;
ASSERT(defParser.ParseFromArgs(3, argv)); ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT(settings._verbose); ASSERT(settings.verbose);
} }
void ignorepathsnopath() { void ignorepathsnopath() {

View File

@ -235,7 +235,7 @@ private:
std::list<std::string> configurations; std::list<std::string> configurations;
std::string filedata = ""; std::string filedata = "";
std::istringstream fin(precode); std::istringstream fin(precode);
preprocessor.preprocess(fin, filedata, configurations, filename, settings._includePaths); preprocessor.preprocess(fin, filedata, configurations, filename, settings.includePaths);
const std::string code = preprocessor.getcode(filedata, "", filename); const std::string code = preprocessor.getcode(filedata, "", filename);
// Tokenize.. // Tokenize..

View File

@ -746,7 +746,7 @@ private:
std::istringstream istr(filedata); std::istringstream istr(filedata);
std::map<std::string, std::string> actual; std::map<std::string, std::string> actual;
Settings settings; Settings settings;
settings._maxConfigs = 1; settings.maxConfigs = 1;
settings.userDefines = "X"; settings.userDefines = "X";
Preprocessor preprocessor(settings, this); Preprocessor preprocessor(settings, this);
preprocessor.preprocess(istr, actual, "file.c"); // <- don't crash preprocessor.preprocess(istr, actual, "file.c"); // <- don't crash
@ -831,7 +831,7 @@ private:
errout.str(""); errout.str("");
Settings settings; Settings settings;
settings.userDefines = "FOO"; settings.userDefines = "FOO";
settings._force = true; // No message if --force is given settings.force = true; // No message if --force is given
Preprocessor preprocessor(settings, this); Preprocessor preprocessor(settings, this);
const std::string code("#error hello world!\n"); const std::string code("#error hello world!\n");
preprocessor.getcode(code, "X", "test.c"); preprocessor.getcode(code, "X", "test.c");
@ -2922,7 +2922,7 @@ private:
void inline_suppression_for_missing_include() { void inline_suppression_for_missing_include() {
Preprocessor::missingIncludeFlag = false; Preprocessor::missingIncludeFlag = false;
Settings settings; Settings settings;
settings._inlineSuppressions = true; settings.inlineSuppressions = true;
settings.addEnabled("all"); settings.addEnabled("all");
Preprocessor preprocessor(settings, this); Preprocessor preprocessor(settings, this);

View File

@ -145,7 +145,7 @@ private:
CppCheck cppCheck(*this, true); CppCheck cppCheck(*this, true);
Settings& settings = cppCheck.settings(); Settings& settings = cppCheck.settings();
settings._inlineSuppressions = true; settings.inlineSuppressions = true;
settings.addEnabled("information"); settings.addEnabled("information");
settings.jointSuppressionReport = true; settings.jointSuppressionReport = true;
if (!suppression.empty()) { if (!suppression.empty()) {
@ -169,8 +169,8 @@ private:
files["test.cpp"] = 1; files["test.cpp"] = 1;
Settings settings; Settings settings;
settings._jobs = 1; settings.jobs = 1;
settings._inlineSuppressions = true; settings.inlineSuppressions = true;
settings.addEnabled("information"); settings.addEnabled("information");
if (!suppression.empty()) { if (!suppression.empty()) {
ASSERT_EQUALS("", settings.nomsg.addSuppressionLine(suppression)); ASSERT_EQUALS("", settings.nomsg.addSuppressionLine(suppression));
@ -372,9 +372,9 @@ private:
CppCheck cppCheck(*this, true); CppCheck cppCheck(*this, true);
Settings& settings = cppCheck.settings(); Settings& settings = cppCheck.settings();
settings.addEnabled("style"); settings.addEnabled("style");
settings._inlineSuppressions = true; settings.inlineSuppressions = true;
settings._relativePaths = true; settings.relativePaths = true;
settings._basePaths.push_back("/somewhere"); settings.basePaths.push_back("/somewhere");
const char code[] = const char code[] =
"struct Point\n" "struct Point\n"
"{\n" "{\n"

View File

@ -53,7 +53,7 @@ private:
filemap[oss.str()] = 1; filemap[oss.str()] = 1;
} }
settings._jobs = jobs; settings.jobs = jobs;
ThreadExecutor executor(filemap, settings, *this); ThreadExecutor executor(filemap, settings, *this);
for (std::map<std::string, std::size_t>::const_iterator i = filemap.begin(); i != filemap.end(); ++i) for (std::map<std::string, std::size_t>::const_iterator i = filemap.begin(); i != filemap.end(); ++i)
executor.addFileContent(i->first, data); executor.addFileContent(i->first, data);

View File

@ -8302,7 +8302,7 @@ private:
std::list<std::string> configurations; std::list<std::string> configurations;
std::string filedata = ""; std::string filedata = "";
std::istringstream fin(raw_code); std::istringstream fin(raw_code);
preprocessor.preprocess(fin, filedata, configurations, emptyString, settings0._includePaths); preprocessor.preprocess(fin, filedata, configurations, emptyString, settings0.includePaths);
const std::string code = preprocessor.getcode(filedata, emptyString, emptyString); const std::string code = preprocessor.getcode(filedata, emptyString, emptyString);
tokenizeAndStringify(code.c_str()); // just survive... tokenizeAndStringify(code.c_str()); // just survive...