Since 2.22.0 the --cppcheck-build-dir cache is discarded with "hash mismatch" on the first re-run of an unchanged file, and only hits from the 3rd run on. 2.21.1 hits on the 2nd run.
In our project almost every TU includes {fmt} 12 (base.h -> format.h -> format-inl.h), so the first re-scan after a full scan re-analyzes everything.
Minimal reproduction (no options other than the build dir):
If the include chain is t.cpp -> a.h -> z.h (load order == alphabetical order), 2.22.0 hits on the 2nd run as expected.
Likely cause: in 2.22.0 the stored <hash> is calculated after preprocessing (files loaded in include order), while the lookup hash is calculated after pre-loading the files listed in <includes> of the existing .a1, which are written in sorted order. The hash seems to depend on the order in which files were loaded, so the two values differ until the .a1 written by the 2nd run is reused.
Environment: Linux x86_64, cppcheck 2.22.0 built from source with gcc. Same result with --project=compile_commands.json and -j N.
Could someone create a Trac ticket for this? Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since 2.22.0 the
--cppcheck-build-dircache is discarded with "hash mismatch" on the first re-run of an unchanged file, and only hits from the 3rd run on. 2.21.1 hits on the 2nd run.In our project almost every TU includes {fmt} 12 (
base.h->format.h->format-inl.h), so the first re-scan after a full scan re-analyzes everything.Minimal reproduction (no options other than the build dir):
2.22.0 output:
2.21.1 output:
If the include chain is
t.cpp -> a.h -> z.h(load order == alphabetical order), 2.22.0 hits on the 2nd run as expected.Likely cause: in 2.22.0 the stored
<hash>is calculated after preprocessing (files loaded in include order), while the lookup hash is calculated after pre-loading the files listed in<includes>of the existing.a1, which are written in sorted order. The hash seems to depend on the order in which files were loaded, so the two values differ until the.a1written by the 2nd run is reused.Environment: Linux x86_64, cppcheck 2.22.0 built from source with gcc. Same result with
--project=compile_commands.jsonand-j N.Could someone create a Trac ticket for this? Thanks.
Claude claims it is fixed:
Feel free to test out HEAD.
Last edit: Daniel Marjamäki 4 days ago