@@ -969,7 +969,8 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
969
969
}
970
970
971
971
// Special Cppcheck Premium options
972
- else if (std::strncmp (argv[i], " --premium=" , 10 ) == 0 && isCppcheckPremium ()) {
972
+ else if ((std::strncmp (argv[i], " --premium=" , 10 ) == 0 || std::strncmp (argv[i], " --premium-" , 10 ) == 0 ) && isCppcheckPremium ()) {
973
+ // valid options --premium=..
973
974
const std::set<std::string> valid{
974
975
" autosar" ,
975
976
" cert-c-2016" ,
@@ -983,6 +984,11 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
983
984
" misra-cpp-2023" ,
984
985
" bughunting" ,
985
986
" safety" };
987
+ // valid options --premium-..=
988
+ const std::set<std::string> valid2{
989
+ " cert-c-int-precision" ,
990
+ " license-file"
991
+ };
986
992
987
993
if (std::strcmp (argv[i], " --premium=safety-off" ) == 0 ) {
988
994
mSettings .safety = false ;
@@ -993,8 +999,9 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
993
999
if (!mSettings .premiumArgs .empty ())
994
1000
mSettings .premiumArgs += " " ;
995
1001
const std::string p (argv[i] + 10 );
996
- if (!valid.count (p) && !startsWith (p, " cert-c-int-precision=" )) {
997
- mLogger .printError (" invalid --premium option '" + p + " '." );
1002
+ const std::string p2 (p.find (' =' ) != std::string::npos ? p.substr (0 , p.find (' =' )) : " " );
1003
+ if (!valid.count (p) && !valid2.count (p2)) {
1004
+ mLogger .printError (" invalid --premium option '" + (p2.empty () ? p : p2) + " '." );
998
1005
return Result::Fail;
999
1006
}
1000
1007
mSettings .premiumArgs += " --" + p;
0 commit comments