IAR: Pass source file to C-STAT co-compile analysis

The <LANG>_ICSTAT co-compile appended --source= only when another
linter (tidy/cpplint/cppcheck/pvs) was also active, so a C-STAT-only
target ran `icstat analyze "" -- ...` with an empty file argument.
Add icstat to the --source= condition so C-STAT gets the real path.

Fixes: #28045
This commit is contained in:
15daksh-2003
2026-08-21 00:55:59 +05:30
parent 419e5f0d6b
commit 1470d96c44
4 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -624,7 +624,7 @@ std::string cmCommonTargetGenerator::GenerateCodeCheckRules(
cmStrCat(icstat, checksParam, dbParam));
}
if (cmNonempty(tidy) || (cmNonempty(cpplint)) || (cmNonempty(cppcheck)) ||
cmNonempty(pvs)) {
cmNonempty(pvs) || cmNonempty(icstat)) {
code_check += " --source=";
code_check +=
this->GeneratorTarget->GetLocalGenerator()->ConvertToOutputFormat(
+2 -1
View File
@@ -1 +1,2 @@
Warning: C-STAT static analysis reported diagnostics.*Severity
Warning: C-STAT static analysis reported diagnostics.*C-STAT analyze source: [^
]*module\.c.*Severity
+2 -1
View File
@@ -1 +1,2 @@
Warning: C-STAT static analysis reported diagnostics.*Severity
Warning: C-STAT static analysis reported diagnostics.*C-STAT analyze source: [^
]*module\.cxx.*Severity
+5
View File
@@ -6,13 +6,18 @@ int main(int argc, char* argv[])
{
int i;
int result = 0;
char const* source = "";
for (i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-bad") == 0) {
fprintf(stdout, "stdout from bad command line arg '-bad'\n");
fprintf(stderr, "stderr from bad command line arg '-bad'\n");
return 1;
}
if (strcmp(argv[i], "analyze") == 0 && i + 1 < argc) {
source = argv[++i];
}
}
fprintf(stderr, "C-STAT analyze source: %s\n", source);
fprintf(stderr,
"\"foo/bar.c\",2 Severity-High[SPC-uninit-var-some]:"
"Variable `i' may be uninitialized.\n\n");