Repository navigation
Fix #15221 (Deprecate the clang import) - #9031
Conversation
|
Tests may be missing |
|
If it's mentioned in the manual maybe we should say that it's deprecated there too? |
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
The new deprecation message goes through the normal error path (mErrorLogger.reportErr). Because of that it counts as a finding: --clang --error-exitcode=1 now exits with 1 on code that has no issues. That would break CI jobs that use --clang as soon as they upgrade. The message is also repeated for every checked file, and for empty files it prints an empty code snippet. A deprecation warning from the command line parser, printed once per run and not counted as a finding, would avoid both problems. The releasenotes change also rewrites the unrelated PCRE2 entry and adds a duplicate "Rules:" item about PCRE2 under "Options". Apart from that I found no problems.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | Tests may be missing | @dmcppcheck | general | ✅ Fixed |
| 2 | Manual should say that the clang import is deprecated | @ludviggunne | general | ✅ Fixed |
| 3 | Deprecation notice counts as a finding: --error-exitcode fails on clean code | AI review | lib/cppcheck.cpp:691 |
🆕 New |
| 4 | Unrelated PCRE2 releasenotes rewrite and duplicate entry | AI review | releasenotes.txt:5 |
🆕 New |
@danmar, please fix, resolve or reply to the open and new comments: #3, #4.
Testing
I built cppcheck and testrunner in pr/ with no errors. I ran python3 -m pytest clang-import_test.py in test/cli (clang is installed here): 38 passed.
Manual tests with a.c containing int f(int x){return x;}, b.c containing a function, and an empty file empty.c:
$ cppcheck --clang --error-exitcode=1 -q a.c; echo ec=$?
a.c:1:1: information: clang import is deprecated, it will be removed in 2.27 [clangimport]
int f(int x){return x;}
^
ec=1
$ cppcheck --clang --error-exitcode=1 -q --suppress=clangimport a.c; echo ec=$?
ec=0
Before the PR, --error-exitcode=1 gave exit code 0 on this clean file.
$ cppcheck --clang -q a.c b.c empty.c
a.c:1:1: information: clang import is deprecated, ... [clangimport]
int f(int x){return x;}
^
b.c:1:1: information: clang import is deprecated, ... [clangimport]
^
empty.c:1:1: information: clang import is deprecated, ... [clangimport]
^
- The message is printed once per file, also with
-j2. - It is also written to
--xmloutput as an<error id="clangimport">. - It is printed again on every run with
--cppcheck-build-dir. clangimportis not listed in--errorlist.
I did not test the GUI because it can't be built here.
Automated review of 97a960c by Claude. The pull request was built and tested locally.
|
Test results for commit 97a960c (tools/test-my-pr.py, main compared to this PR): Test: http://ec2-16-170-140-253.eu-north-1.compute.amazonaws.com/pr-9031/ Posted automatically by the cppcheck PR test runner. +N: warnings only with this PR, -N: warnings only with main. The AI review is written by Claude and can be wrong. |
No description provided.