When creating a dump with the '--dump' option, header files are skipped.
When analyzing the code, the headers seem to be included, because issues in the headers are found.
Is this an omission from the '--dump' option?
mark@dev3:~/cppcheck_test/build$cppcheck--project=compile_commands.json--dumpChecking/home/mark/cppcheck_test/main.cpp...1/2fileschecked50%doneChecking/home/mark/cppcheck_test/test.cpp.../home/mark/cppcheck_test/test.h:7:12:error:Nullpointerdereference:(int*)0[nullPointer]inti=*((int*)0);^2/2fileschecked100%doneActivecheckers:59/565mark@dev3:~/cppcheck_test/build$ll..total44drwxrwxr-x3markmark4096Jun1112:10./drwxr-xr-x39markmark4096Jun1112:09../drwxrwxr-x3markmark4096Jun1112:09build/-rw-r--r--1markmark122Jun1112:09CMakeLists.txt-rw-r--r--1markmark0Jun1112:08main.cpp-rw-rw-r--1markmark300Jun1112:10main.cpp.dump-rw-r--r--1markmark75Jun1112:08test.cpp-rw-rw-r--1markmark13549Jun1112:10test.cpp.dump-rw-r--r-- 1 mark mark 128 Jun 11 12:08 test.h
Last edit: Mark Jansen 2024-06-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When creating a dump with the '--dump' option, header files are skipped.
When analyzing the code, the headers seem to be included, because issues in the headers are found.
Is this an omission from the '--dump' option?
Last edit: Mark Jansen 2024-06-11
hm.. the raw tokens in headers are not listed. This is true.
However "non-raw" tokens in headers are listed in the "tokenlist".
It does seem unfortunate to me however how much bigger would the dump files be if we included all raw tokens for all headers also..
But in the current form, there are no .dump files generated for project headers,
so addons also cannot process headers.
dumpfiles are not created for every header by design.
The dumpfile for 1.c contains the tokens in the headers :
Last edit: Daniel Marjamäki 2024-06-12
hmm I changed my mind and the
<rawtoken>
will not contain the raw tokens for the headers.I did miss that the tokenlist does contain the tokens for headers,
for my use case this should probably be enough.
In a bigger project this means a lot of duplicated data, but if that is not an issue I guess there is no change needed in cppcheck.
I created this ticket:
https://trac.cppcheck.net/ticket/12830