Skip to content

Commit 1167ba0

Browse files
committed
fixed #13623 - reworked handling of options in GUI projects [skip ci]
1 parent 5147b19 commit 1167ba0

File tree

3 files changed

+157
-149
lines changed

3 files changed

+157
-149
lines changed

cli/cmdlineparser.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,31 +1184,17 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
11841184

11851185
mSettings.checkAllConfigurations = false; // Can be overridden with --max-configs or --force
11861186
std::string projectFile = argv[i]+10;
1187-
projectType = project.import(projectFile, &mSettings, &mSuppressions);
1187+
projectType = project.import(projectFile, mSettings.fileFilters);
11881188
if (projectType == ImportProject::Type::CPPCHECK_GUI) {
1189-
for (const std::string &lib : project.guiProject.libraries)
1190-
mSettings.libraries.emplace_back(lib);
1191-
1192-
const auto& excludedPaths = project.guiProject.excludedPaths;
1193-
std::copy(excludedPaths.cbegin(), excludedPaths.cend(), std::back_inserter(mIgnoredPaths));
1194-
1195-
std::string platform(project.guiProject.platform);
1196-
1197-
// keep existing platform from command-line intact
1198-
if (!platform.empty()) {
1199-
std::string errstr;
1200-
const std::vector<std::string> paths = {projectFile, argv[0]};
1201-
if (!mSettings.platform.set(platform, errstr, paths, mSettings.debuglookup || mSettings.debuglookupPlatform)) {
1202-
mLogger.printError(errstr);
1203-
return Result::Fail;
1204-
}
1205-
}
1189+
if (mSettings.debugnormal && !project.guiProject.args.empty()) // TODO: add separate debug option
1190+
std::cout << project.guiProject.args << std::endl;
1191+
// TODO: inject arguments
12061192

12071193
const auto& projectFileGui = project.guiProject.projectFile;
12081194
if (!projectFileGui.empty()) {
12091195
// read underlying project
12101196
projectFile = projectFileGui;
1211-
projectType = project.import(projectFileGui, &mSettings, &mSuppressions);
1197+
projectType = project.import(projectFileGui, mSettings.fileFilters);
12121198
if (projectType == ImportProject::Type::CPPCHECK_GUI) {
12131199
mLogger.printError("nested Cppcheck GUI projects are not supported.");
12141200
return Result::Fail;
@@ -1639,7 +1625,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
16391625
}
16401626

16411627
// Print error only if we have "real" command and expect files
1642-
if (mPathNames.empty() && project.guiProject.pathNames.empty() && project.fileSettings.empty()) {
1628+
if (mPathNames.empty() && project.fileSettings.empty()) {
16431629
// TODO: this message differs from the one reported in fillSettingsFromArgs()
16441630
mLogger.printError("no C or C++ source files found.");
16451631
return Result::Fail;
@@ -1663,9 +1649,6 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
16631649
}
16641650
}
16651651

1666-
if (!project.guiProject.pathNames.empty())
1667-
mPathNames = project.guiProject.pathNames;
1668-
16691652
if (!project.fileSettings.empty()) {
16701653
project.ignorePaths(mIgnoredPaths, mSettings.debugignore);
16711654
if (project.fileSettings.empty()) {

0 commit comments

Comments
 (0)