Repository navigation
Fix #15222 FN constParameterPointer (parameters declared in macro) - #9032
chrchr-github wants to merge 3 commits into
Conversation
|
Test results for commit 4d43809 (tools/test-my-pr.py, main compared to this PR): Test: http://ec2-16-170-140-253.eu-north-1.compute.amazonaws.com/pr-9032/ 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. |
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no problems. The set comparator now orders by token index (precedes) instead of by file, line and column. This fixes the case where several variables that come from one macro expansion share a location and were treated as equal keys, so all but one were dropped. Token indexes are assigned once at the end of simplifyTokenList1 (and in the clang import), before the symbol database is created, so each variable's name token has a unique index here. I checked parameters and locals declared in macros, repeated macro invocations, ordinary code and template functions. All of them gave the expected results.
Testing
I built cppcheck and testrunner in pr/, and cppcheck in base/.
./testrunner TestOther: 255 tests, 0 failures.- I ran
cppcheck -q --enable=stylefrom both builds on a scratch file with these cases:- The PR's case:
#define DECL_ARGS S *p, S *q/void f(DECL_ARGS). The PR reportspandq. Base reported only one of them. - Locals declared in a macro:
#define LOC S *a = g(); S *b = g();. The PR now reports bothconstVariablePointerwarnings. - A function-defining macro invoked twice on one line: both parameters are reported.
- Ordinary parameters: unchanged, both reported.
- Template functions: one that only reads through the pointer and one that writes through it. Base and PR give the same output.
- The PR's case:
Over the two scratch files, the PR reports 8 style warnings and base reports 6. The 2 extra warnings are the intended new detections.
Automated review of 4d43809 by Claude. The pull request was built and tested locally.
No description provided.