analyzing one vs config (first debug config that matches platform)
This commit is contained in:
parent
d3e7d09f5c
commit
a0dd853642
|
@ -556,8 +556,8 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
|||
mSettings->platform(Settings::Unix64);
|
||||
else if (platform == "native")
|
||||
mSettings->platform(Settings::Native);
|
||||
else if (platform == "unspecified")
|
||||
mSettings->platform(Settings::Unspecified);
|
||||
else if (platform == "unspecified" || platform == "Unspecified" || platform == "")
|
||||
;
|
||||
else if (!mSettings->loadPlatformFile(argv[0], platform)) {
|
||||
std::string message("cppcheck: error: unrecognized platform: \"");
|
||||
message += platform;
|
||||
|
@ -570,6 +570,8 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
|||
projType = mSettings->project.import(mSettings->project.guiProject.projectFile, mSettings);
|
||||
}
|
||||
if (projType == ImportProject::Type::VS_SLN || projType == ImportProject::Type::VS_VCXPROJ) {
|
||||
if (mSettings->project.guiProject.analyzeAllVsConfigs == "false")
|
||||
mSettings->project.selectOneVsConfig(mSettings->platformType);
|
||||
if (!CppCheckExecutor::tryLoadLibrary(mSettings->library, argv[0], "windows.cfg")) {
|
||||
// This shouldn't happen normally.
|
||||
printMessage("cppcheck: Failed to load 'windows.cfg'. Your Cppcheck installation is broken. Please re-install.");
|
||||
|
|
|
@ -877,24 +877,27 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
|
|||
|
||||
std::size_t processedsize = 0;
|
||||
unsigned int c = 0;
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
|
||||
if (!_settings->library.markupFile(i->first)
|
||||
|| !_settings->library.processMarkupAfterCode(i->first)) {
|
||||
returnValue += cppcheck.check(i->first);
|
||||
processedsize += i->second;
|
||||
if (!settings.quiet)
|
||||
reportStatus(c + 1, _files.size(), processedsize, totalfilesize);
|
||||
c++;
|
||||
if (settings.project.fileSettings.empty()) {
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
|
||||
if (!_settings->library.markupFile(i->first)
|
||||
|| !_settings->library.processMarkupAfterCode(i->first)) {
|
||||
returnValue += cppcheck.check(i->first);
|
||||
processedsize += i->second;
|
||||
if (!settings.quiet)
|
||||
reportStatus(c + 1, _files.size(), processedsize, totalfilesize);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// filesettings
|
||||
c = 0;
|
||||
for (const ImportProject::FileSettings &fs : settings.project.fileSettings) {
|
||||
returnValue += cppcheck.check(fs);
|
||||
++c;
|
||||
if (!settings.quiet)
|
||||
reportStatus(c, settings.project.fileSettings.size(), c, settings.project.fileSettings.size());
|
||||
// filesettings
|
||||
c = 0;
|
||||
for (const ImportProject::FileSettings &fs : settings.project.fileSettings) {
|
||||
returnValue += cppcheck.check(fs);
|
||||
++c;
|
||||
if (!settings.quiet)
|
||||
reportStatus(c, settings.project.fileSettings.size(), c, settings.project.fileSettings.size());
|
||||
}
|
||||
}
|
||||
|
||||
// second loop to parse all markup files which may not work until all
|
||||
|
|
|
@ -405,32 +405,8 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLibrary, cons
|
|||
p.ignorePaths(v);
|
||||
|
||||
if (!mProjectFile->getAnalyzeAllVsConfigs()) {
|
||||
std::set<std::string> filenames;
|
||||
Settings::PlatformType platform = (Settings::PlatformType) mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt();
|
||||
for (std::list<ImportProject::FileSettings>::iterator it = p.fileSettings.begin(); it != p.fileSettings.end();) {
|
||||
if (it->cfg.empty()) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
const ImportProject::FileSettings &fs = *it;
|
||||
bool remove = false;
|
||||
if (fs.cfg.compare(0,5,"Debug") != 0)
|
||||
remove = true;
|
||||
if (platform == Settings::Win64 && fs.platformType != platform)
|
||||
remove = true;
|
||||
else if ((platform == Settings::Win32A || platform == Settings::Win32W) && fs.platformType == Settings::Win64)
|
||||
remove = true;
|
||||
else if (fs.platformType != Settings::Win64 && platform == Settings::Win64)
|
||||
remove = true;
|
||||
else if (filenames.find(fs.filename) != filenames.end())
|
||||
remove = true;
|
||||
if (remove) {
|
||||
it = p.fileSettings.erase(it);
|
||||
} else {
|
||||
filenames.insert(fs.filename);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
p.selectOneVsConfig(platform);
|
||||
}
|
||||
} else {
|
||||
enableProjectActions(false);
|
||||
|
|
|
@ -1003,6 +1003,8 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
|
|||
std::list<std::string> suppressions;
|
||||
Settings temp;
|
||||
|
||||
guiProject.analyzeAllVsConfigs = false;
|
||||
|
||||
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
|
||||
if (strcmp(node->Name(), RootPathName) == 0 && node->Attribute(RootPathNameAttrib))
|
||||
temp.basePaths.push_back(joinRelativePath(path, node->Attribute(RootPathNameAttrib)));
|
||||
|
@ -1030,7 +1032,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
|
|||
else if (strcmp(node->Name(), PlatformElementName) == 0)
|
||||
guiProject.platform = node->GetText();
|
||||
else if (strcmp(node->Name(), AnalyzeAllVsConfigsElementName) == 0)
|
||||
; // FIXME: Write some warning
|
||||
guiProject.analyzeAllVsConfigs = node->GetText();
|
||||
else if (strcmp(node->Name(), AddonsElementName) == 0)
|
||||
temp.addons = readXmlStringList(node, "", AddonElementName, nullptr);
|
||||
else if (strcmp(node->Name(), TagsElementName) == 0)
|
||||
|
@ -1061,3 +1063,32 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
|
|||
settings->maxCtuDepth = temp.maxCtuDepth;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImportProject::selectOneVsConfig(Settings::PlatformType platform)
|
||||
{
|
||||
std::set<std::string> filenames;
|
||||
for (std::list<ImportProject::FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
|
||||
if (it->cfg.empty()) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
const ImportProject::FileSettings &fs = *it;
|
||||
bool remove = false;
|
||||
if (fs.cfg.compare(0,5,"Debug") != 0)
|
||||
remove = true;
|
||||
if (platform == Settings::Win64 && fs.platformType != platform)
|
||||
remove = true;
|
||||
else if ((platform == Settings::Win32A || platform == Settings::Win32W) && fs.platformType == Settings::Win64)
|
||||
remove = true;
|
||||
else if (fs.platformType != Settings::Win64 && platform == Settings::Win64)
|
||||
remove = true;
|
||||
else if (filenames.find(fs.filename) != filenames.end())
|
||||
remove = true;
|
||||
if (remove) {
|
||||
it = fileSettings.erase(it);
|
||||
} else {
|
||||
filenames.insert(fs.filename);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,8 +82,11 @@ public:
|
|||
};
|
||||
std::list<FileSettings> fileSettings;
|
||||
|
||||
void selectOneVsConfig(cppcheck::Platform::PlatformType platform);
|
||||
|
||||
// Cppcheck GUI output
|
||||
struct {
|
||||
std::string analyzeAllVsConfigs;
|
||||
std::vector<std::string> pathNames;
|
||||
std::list<std::string> libraries;
|
||||
std::list<std::string> excludedPaths;
|
||||
|
|
Loading…
Reference in New Issue