@@ -321,6 +321,31 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
321321 // default to --check-level=normal from CLI for now
322322 mSettings .setCheckLevel (Settings::CheckLevel::normal);
323323
324+ for (int i = 1 ; i < argc; i++) {
325+ // Show debug warnings for lookup for configuration files
326+ if (std::strcmp (argv[i], " --debug-lookup" ) == 0 )
327+ mSettings .debuglookup = true ;
328+
329+ else if (std::strncmp (argv[i], " --debug-lookup=" , 15 ) == 0 ) {
330+ const std::string lookup = argv[i] + 15 ;
331+ if (lookup == " all" )
332+ mSettings .debuglookup = true ;
333+ else if (lookup == " addon" )
334+ mSettings .debuglookupAddon = true ;
335+ else if (lookup == " config" )
336+ mSettings .debuglookupConfig = true ;
337+ else if (lookup == " library" )
338+ mSettings .debuglookupLibrary = true ;
339+ else if (lookup == " platform" )
340+ mSettings .debuglookupPlatform = true ;
341+ else
342+ {
343+ mLogger .printError (" unknown lookup '" + lookup + " '" );
344+ return Result::Fail;
345+ }
346+ }
347+ }
348+
324349 if (!loadCppcheckCfg ())
325350 return Result::Fail;
326351
@@ -612,28 +637,11 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
612637 std::strcmp (argv[i], " --debug-normal" ) == 0 )
613638 debug = true ;
614639
615- // Show debug warnings for lookup for configuration files
616640 else if (std::strcmp (argv[i], " --debug-lookup" ) == 0 )
617- mSettings . debuglookup = true ;
641+ continue ; // already handled
618642
619- else if (std::strncmp (argv[i], " --debug-lookup=" , 15 ) == 0 ) {
620- const std::string lookup = argv[i] + 15 ;
621- if (lookup == " all" )
622- mSettings .debuglookup = true ;
623- else if (lookup == " addon" )
624- mSettings .debuglookupAddon = true ;
625- else if (lookup == " config" )
626- mSettings .debuglookupConfig = true ;
627- else if (lookup == " library" )
628- mSettings .debuglookupLibrary = true ;
629- else if (lookup == " platform" )
630- mSettings .debuglookupPlatform = true ;
631- else
632- {
633- mLogger .printError (" unknown lookup '" + lookup + " '" );
634- return Result::Fail;
635- }
636- }
643+ else if (std::strncmp (argv[i], " --debug-lookup=" , 15 ) == 0 )
644+ continue ; // already handled
637645
638646 // Flag used for various purposes during debugging
639647 else if (std::strcmp (argv[i], " --debug-simplified" ) == 0 )
0 commit comments