From e2925a2c15dde7a2707f8bb5ea5c8760fae2d4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 13 Aug 2025 03:49:17 +0200 Subject: [PATCH 1/4] Fix #14067 (cmdlineparser: tweaks to --premium) --- cli/cmdlineparser.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 608e1844716..cfa9736c904 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -1117,12 +1117,14 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a mSettings.premiumArgs += " "; const std::string p(argv[i] + 10); const std::string p2(p.find('=') != std::string::npos ? p.substr(0, p.find('=')) : ""); - if (!valid.count(p) && !valid2.count(p2)) { + const bool isCodingStandard = startsWith(p, "autosar") || startsWith(p,"cert-") || startsWith(p,"misra-"); + const std::string p3(endsWith(p,":all") && isCodingStandard ? p.substr(0,p.rfind(':')) : p); + if (!valid.count(p3) && !valid2.count(p2)) { mLogger.printError("invalid --premium option '" + (p2.empty() ? p : p2) + "'."); return Result::Fail; } mSettings.premiumArgs += "--" + p; - if (startsWith(p, "autosar") || startsWith(p, "cert") || startsWith(p, "misra")) { + if (isCodingStandard) { // All checkers related to the coding standard should be enabled. The coding standards // do not all undefined behavior or portability issues. mSettings.addEnabled("warning"); @@ -1881,16 +1883,22 @@ void CmdLineParser::printHelp() const " --premium=