mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
IAR: Fix malformed C-STAT command line
There was an issue with a malformed command line introduced in
commit c7d2a172 (IAR: Add support for C-STAT static analysis,
2025-04-08, v4.1.0-rc1~385^2), where the source file was
incorrectly passed as a parameter when executing `icstat` in
HandleIcstat(). `icstat` does not take the source file as a
direct parameter.
This commit is contained in:
@@ -607,21 +607,22 @@ std::string cmCommonTargetGenerator::GenerateCodeCheckRules(
|
||||
}
|
||||
if (cmNonempty(icstat)) {
|
||||
code_check += " --icstat=";
|
||||
// Unless specified otherwise via CMAKE_<LANG>_ICSTAT,
|
||||
// populate the icstat command line using default options
|
||||
// for its mandatory parameters.
|
||||
std::string checksParam{};
|
||||
std::string dbParam{};
|
||||
// Set default values for mandatory parameters
|
||||
std::string checksFile{ "cstat_sel_checks.txt" };
|
||||
std::string dbFile{ "cstat.db" };
|
||||
// Populate the command line with C-STAT
|
||||
// mandatory parameters unless specified
|
||||
if (icstat.find("--checks=") == std::string::npos) {
|
||||
std::string const checksFile{ "cstat_sel_checks.txt" };
|
||||
checksParam = cmStrCat(";--checks=", checksFile);
|
||||
}
|
||||
std::string dbParam{};
|
||||
if (icstat.find("--db=") == std::string::npos) {
|
||||
std::string const dbFile{ "cstat.db" };
|
||||
dbParam = cmStrCat(";--db=", dbFile);
|
||||
}
|
||||
std::string analyzeCmd{ ";analyze" };
|
||||
code_check += this->GeneratorTarget->GetLocalGenerator()->EscapeForShell(
|
||||
cmStrCat(icstat, checksParam, dbParam));
|
||||
cmStrCat(icstat, checksParam, dbParam, analyzeCmd));
|
||||
}
|
||||
if (cmNonempty(tidy) || (cmNonempty(cpplint)) || (cmNonempty(cppcheck)) ||
|
||||
cmNonempty(pvs) || cmNonempty(icstat)) {
|
||||
|
||||
+3
-6
@@ -623,18 +623,15 @@ int HandleIcstat(std::string const& runCmd, std::string const& sourceFile,
|
||||
{
|
||||
// Construct the IAR C-STAT command line.
|
||||
cmList icstat_cmd{ runCmd, cmList::EmptyElements::Yes };
|
||||
std::string icstat_analyze{ "analyze" };
|
||||
std::string icstat_dashdash{ "--" };
|
||||
std::string stdOut;
|
||||
std::string stdErr;
|
||||
int ret;
|
||||
|
||||
icstat_cmd.push_back(icstat_analyze);
|
||||
icstat_cmd.push_back(sourceFile);
|
||||
icstat_cmd.push_back(icstat_dashdash);
|
||||
std::string const double_dash{ "--" };
|
||||
icstat_cmd.push_back(double_dash);
|
||||
|
||||
for (auto const& cmd : orig_cmd) {
|
||||
icstat_cmd.push_back(cmd);
|
||||
icstat_cmd.emplace_back(cmd);
|
||||
}
|
||||
|
||||
// Create the default manifest ruleset file when not found
|
||||
|
||||
Reference in New Issue
Block a user