@@ -1103,12 +1103,14 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
11031103 mSettings .premiumArgs += " " ;
11041104 const std::string p (argv[i] + 10 );
11051105 const std::string p2 (p.find (' =' ) != std::string::npos ? p.substr (0 , p.find (' =' )) : " " );
1106- if (!valid.count (p) && !valid2.count (p2)) {
1106+ const bool isCodingStandard = startsWith (p, " autosar" ) || startsWith (p," cert-" ) || startsWith (p," misra-" );
1107+ const std::string p3 (endsWith (p," :all" ) && isCodingStandard ? p.substr (0 ,p.rfind (' :' )) : p);
1108+ if (!valid.count (p3) && !valid2.count (p2)) {
11071109 mLogger .printError (" invalid --premium option '" + (p2.empty () ? p : p2) + " '." );
11081110 return Result::Fail;
11091111 }
11101112 mSettings .premiumArgs += " --" + p;
1111- if (startsWith (p, " autosar " ) || startsWith (p, " cert " ) || startsWith (p, " misra " ) ) {
1113+ if (isCodingStandard ) {
11121114 // All checkers related to the coding standard should be enabled. The coding standards
11131115 // do not all undefined behavior or portability issues.
11141116 mSettings .addEnabled (" warning" );
@@ -1862,9 +1864,13 @@ void CmdLineParser::printHelp() const
18621864 " * misra-c-2025 Misra C 2025\n "
18631865 " * misra-c++-2008 Misra C++ 2008\n "
18641866 " * misra-c++-2023 Misra C++ 2023\n "
1867+ " By default 'Misra/Cert C' only checks C files.\n "
1868+ " By default 'Autosar/Misra/Cert C++' only checks C++ files.\n "
1869+ " To check all files, append \" :all\" i.e. --premium=misra-c++-2023:all.\n "
18651870 " Other:\n "
18661871 " * bughunting Soundy analysis\n "
18671872 " * cert-c-int-precision=BITS Integer precision to use in Cert C analysis.\n "
1873+ " * metrics Calculate metrics. Metrics are only reported in xmlv3 output.\n "
18681874 " * safety Turn on safety certified behavior (ON by default)\n "
18691875 " * safety-off Turn off safety certified behavior\n " ;
18701876 }
0 commit comments