Repository navigation
Conversation
…eck-build-dir) Write nested calls as nested-call elements in the CTU info. loadFromXml() only reads nested calls from nested-call elements, so a call chain through a wrapper function was lost when the whole program analysis loads the build dir data: with -j2 and more, with -j1 as soon as one of the files is unchanged, and in the GUI.
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no problems. The fix is correct. NestedCall::toXmlString() now writes <nested-call>, which is the name CTU::FileInfo::loadFromXml() expects, and its tag stays self-closing. Old analyzer-info files that hold the wrong <function-call> elements don't need special handling. Before the fix, those elements failed FunctionCall::loadFromXml because call-argexpr and related attributes were missing, so they were just dropped. On top of that, the cache hash includes the cppcheck version, so old files are not reused after an upgrade. The only other reader of function-call is test/cli/other_test.py:4648, which reads FileInfo/function-call/path and is not affected. I have no new problems to report.
Testing
-
I built
cppcheckandtestrunnerinpr/without errors. -
./testrunner TestNullPointer TestUninitVar TestBufferOverrun TestCppcheck TestAnalyzerInformation: 433 tests, 0 failed. This includes the newctuXmltest. -
pytest whole-program_test.py: 30 passed, 6 xfailed. This includes the 3 new tests. -
pytest other_test.py -k "analyzerinfo or ctu or nested or build": 17 passed, 1 xfailed. -
I wrote my own test with wrapper chains across two files, run with
--enable=warning:- a two-level wrapper (
w1 -> mid -> deref) - conditional wrappers
- a guarded wrapper (
if (p) deref(p)) ctuuninitvarthrough a wrapperctuArrayIndexthrough a wrapper
I ran it three ways: without a build dir, with
-j2 --cppcheck-build-dir, and with-j1against the cached build dir. All three gave the same output:ctunullpointer,ctuuninitvarandctuArrayIndex, with no false positive for the guarded wrapper. - a two-level wrapper (
-
I also tried mutual recursion across files (
a -> b -> a) with and without a build dir. Neither hung, and both gave the same (empty) result. -
I did not build
base/. In the PR build, results with a build dir now match results without one.
Automated review of 872dbb3 by Claude. The pull request was built and tested locally.
|
Test results for commit 872dbb3 (tools/test-my-pr.py, main compared to this PR): Test: http://ec2-16-170-140-253.eu-north-1.compute.amazonaws.com/pr-9024/ 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. |
NestedCall::toXmlString()writes a<function-call>element butloadFromXml()only reads nested calls from<nested-call>elements. So the nested calls are dropped when the CTU info is read back from the build dir: with-j2and more, with-j1as soon as one of the files is unchanged, and in the GUI. A null pointer passed through a wrapper function is then not reported.header.htest1.ctest2.cBefore PR: no output.
After PR: