Hi
I'm using the current 1.84 on a Win10-64 system. I have a big source tree that I'd like to check.
If I give just the root folder then CppCheck runs through it and gives me the results. However
there are many syntax errors that really aren't, it probably just hasn't seen the necessary
header files which are also in this tree. Also --check-config reports those header files as missing.
Okay, so I then added all the necessary paths to those includes. I tried the command line
switches -I as well as putting all those directories in a file and using it with --includes-file.
Both variants result in the same behavior: On one system CppCheck crashed immediately
("... stopped working."). On another system it started checking the first .cpp file and then
finished, without giving an error or any other indication what's wrong. The xml logfile
was unclosed and therefore invalid.
--check-config spews out a lot of warnings about not found standard library headers. But as
it also says itself "Cppcheck does not need standard library headers to get proper results."
So it is difficult to see the other missing headers. Is there a possibility to suppress those
standard header warnings?
I also tried speeding it up by using -j 4. It really was faster, only the result file was now much
smaller than without -j. So it didn't produce the same results. Shouldn't that be the case?
I can check all compiler directive combinations. But to speed up the process I'd also want
to give all the necessary -D defines. As there are dozens this makes the command line very
long and difficult to read. Especially if there are different directives for different use cases.
Would it be possible to add a switch --define-file or something like that to have all the
defines in a separate file?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since it seems to be fixed with HEAD i guess it makes not much sense to investigate why it fails with 1.84. 1.85 should be released soon and i would test it again then.
-j 4 actually could have less results than analyzing with a single thread. The reason is that the whole program analysis can not be made. At least as long as you do not specify a build dir. Then the results should not differ (at least not much i guess).
If you specify many defines and do not want to add them to the command line there are at least two options i know of:
1. Use the --include= option to specify a header file with all your defines that is then included before each checked file:
--include=<file>
Force inclusion of a file before the checked file. Can
be used for example when checking the Linux kernel,
where autoconf.h needs to be included for every file
compiled. Works the same way as the GCC -include
option.
Create a configuration/library file and enable it via --library= on the command line:
--library=<cfg> Load file <cfg> that contains information about types
and functions. With such information Cppcheck
understands your code better and therefore you
get better results. The std.cfg file that is
distributed with Cppcheck is loaded automatically.
For more information about library files, read the
manual.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ah, and about your question about suppressing the messages for missing system includes you can use --suppress=missingIncludeSystem on the command line.
Or if you have created a project in the GUI you can open the project editor dialog, go to the "Warning options" tab and click on the "Add" button to the right of the Suppressions list. Then choose missingIncludeSystem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I'm using the current 1.84 on a Win10-64 system. I have a big source tree that I'd like to check.
If I give just the root folder then CppCheck runs through it and gives me the results. However
there are many syntax errors that really aren't, it probably just hasn't seen the necessary
header files which are also in this tree. Also --check-config reports those header files as missing.
Okay, so I then added all the necessary paths to those includes. I tried the command line
switches -I as well as putting all those directories in a file and using it with --includes-file.
Both variants result in the same behavior: On one system CppCheck crashed immediately
("... stopped working."). On another system it started checking the first .cpp file and then
finished, without giving an error or any other indication what's wrong. The xml logfile
was unclosed and therefore invalid.
--check-config spews out a lot of warnings about not found standard library headers. But as
it also says itself "Cppcheck does not need standard library headers to get proper results."
So it is difficult to see the other missing headers. Is there a possibility to suppress those
standard header warnings?
I also tried speeding it up by using -j 4. It really was faster, only the result file was now much
smaller than without -j. So it didn't produce the same results. Shouldn't that be the case?
I can check all compiler directive combinations. But to speed up the process I'd also want
to give all the necessary -D defines. As there are dozens this makes the command line very
long and difficult to read. Especially if there are different directives for different use cases.
Would it be possible to add a switch --define-file or something like that to have all the
defines in a separate file?
Thanks
Looks like the crash/hang is solved with the current HEAD. Don't know yet about the results as it "runs" much slower now.
Since it seems to be fixed with HEAD i guess it makes not much sense to investigate why it fails with 1.84. 1.85 should be released soon and i would test it again then.
-j 4
actually could have less results than analyzing with a single thread. The reason is that the whole program analysis can not be made. At least as long as you do not specify a build dir. Then the results should not differ (at least not much i guess).If you specify many defines and do not want to add them to the command line there are at least two options i know of:
1. Use the
--include=
option to specify a header file with all your defines that is then included before each checked file:--library=
on the command line:Ah, and about your question about suppressing the messages for missing system includes you can use
--suppress=missingIncludeSystem
on the command line.Or if you have created a project in the GUI you can open the project editor dialog, go to the "Warning options" tab and click on the "Add" button to the right of the Suppressions list. Then choose
missingIncludeSystem
.Thanks a lot for those pointers, I'll try them out.