@@ -407,8 +407,6 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
407407 }
408408 }
409409
410- bool def = false ;
411- bool maxconfigs = false ;
412410 bool debug = false ;
413411 bool inputAsFilter = false ; // set by: --file-filter=+
414412
@@ -421,7 +419,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
421419
422420 std::vector<std::string> lookupPaths{
423421 Path::getCurrentPath (), // TODO: do we want to look in CWD?
424- Path::getPathFromFilename (argv[ 0 ])
422+ Path::getPathFromFilename (mSettings . exename ),
425423 };
426424
427425 bool executorAuto = true ;
@@ -457,8 +455,6 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
457455 if (!mSettings .userDefines .empty ())
458456 mSettings .userDefines += " ;" ;
459457 mSettings .userDefines += define;
460-
461- def = true ;
462458 }
463459
464460 // -E
@@ -801,8 +797,10 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
801797 }
802798
803799 // Force checking of files that have "too many" configurations
804- else if (std::strcmp (argv[i], " -f" ) == 0 || std::strcmp (argv[i], " --force" ) == 0 )
800+ else if (std::strcmp (argv[i], " -f" ) == 0 || std::strcmp (argv[i], " --force" ) == 0 ) {
805801 mSettings .force = true ;
802+ mSettings .maxConfigsOption = Settings::maxConfigsNotAssigned;
803+ }
806804
807805 else if (std::strcmp (argv[i], " --fsigned-char" ) == 0 )
808806 defaultSign = ' s' ;
@@ -974,9 +972,8 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
974972 return Result::Fail;
975973 }
976974
977- mSettings .maxConfigs = tmp;
975+ mSettings .maxConfigsOption = tmp;
978976 mSettings .force = false ;
979- maxconfigs = true ;
980977 }
981978
982979 // max ctu depth
@@ -1160,7 +1157,6 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
11601157 return Result::Fail;
11611158 }
11621159
1163- mSettings .checkAllConfigurations = false ; // Can be overridden with --max-configs or --force
11641160 std::string projectFile = argv[i]+10 ;
11651161 projectType = project.import (projectFile, &mSettings , &mSuppressions );
11661162 if (projectType == ImportProject::Type::CPPCHECK_GUI) {
@@ -1187,6 +1183,8 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
11871183 }
11881184 }
11891185 }
1186+ if (projectType == ImportProject::Type::COMPILE_DB)
1187+ mSettings .maxConfigsProject = 1 ;
11901188 if (projectType == ImportProject::Type::VS_SLN || projectType == ImportProject::Type::VS_VCXPROJ) {
11911189 mSettings .libraries .emplace_back (" windows" );
11921190 }
@@ -1591,14 +1589,6 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
15911589 substituteTemplateFormatStatic (mSettings .templateFormat , !mSettings .outputFile .empty ());
15921590 substituteTemplateLocationStatic (mSettings .templateLocation , !mSettings .outputFile .empty ());
15931591
1594- if (mSettings .force || maxconfigs)
1595- mSettings .checkAllConfigurations = true ;
1596-
1597- if (mSettings .force )
1598- mSettings .maxConfigs = INT_MAX;
1599- else if ((def || mSettings .preprocessOnly ) && !maxconfigs)
1600- mSettings .maxConfigs = 1U ;
1601-
16021592 if (debug) {
16031593 mSettings .debugnormal = true ;
16041594 mSettings .debugvalueflow = true ;
0 commit comments