@@ -1117,12 +1117,14 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
11171117 mSettings .premiumArgs += " " ;
11181118 const std::string p (argv[i] + 10 );
11191119 const std::string p2 (p.find (' =' ) != std::string::npos ? p.substr (0 , p.find (' =' )) : " " );
1120- if (!valid.count (p) && !valid2.count (p2)) {
1120+ const bool isCodingStandard = startsWith (p, " autosar" ) || startsWith (p," cert-" ) || startsWith (p," misra-" );
1121+ const std::string p3 (endsWith (p," :all" ) && isCodingStandard ? p.substr (0 ,p.rfind (' :' )) : p);
1122+ if (!valid.count (p3) && !valid2.count (p2)) {
11211123 mLogger .printError (" invalid --premium option '" + (p2.empty () ? p : p2) + " '." );
11221124 return Result::Fail;
11231125 }
11241126 mSettings .premiumArgs += " --" + p;
1125- if (startsWith (p, " autosar " ) || startsWith (p, " cert " ) || startsWith (p, " misra " ) ) {
1127+ if (isCodingStandard ) {
11261128 // All checkers related to the coding standard should be enabled. The coding standards
11271129 // do not all undefined behavior or portability issues.
11281130 mSettings .addEnabled (" warning" );
@@ -1888,9 +1890,13 @@ void CmdLineParser::printHelp() const
18881890 " * misra-c-2025 Misra C 2025\n "
18891891 " * misra-c++-2008 Misra C++ 2008\n "
18901892 " * misra-c++-2023 Misra C++ 2023\n "
1893+ " By default 'Misra/Cert C' only checks C files.\n "
1894+ " By default 'Autosar/Misra/Cert C++' only checks C++ files.\n "
1895+ " To check all files, append \" :all\" i.e. --premium=misra-c++-2023:all.\n "
18911896 " Other:\n "
18921897 " * bughunting Soundy analysis\n "
18931898 " * cert-c-int-precision=BITS Integer precision to use in Cert C analysis.\n "
1899+ " * metrics Calculate metrics. Metrics are only reported in xmlv3 output.\n "
18941900 " * safety Turn on safety certified behavior (ON by default)\n "
18951901 " * safety-off Turn off safety certified behavior\n " ;
18961902 }
0 commit comments