mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
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:
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user