I have observed that cppcheck treat all headers included as #include <...> as system headers. This makes sense, but it is also true that people don't use <> only for system headers. It, thus, is not good to --suppress=missingIncludeSystem as that might hide other problems for headers that are actually not system headers. Specifying --library=std does not help.
Is it possible for Cppcheck to be aware of which header it does not need any information so it would not print the warning?
Is it possible to create a suppression that would ignore headers that do not contain .h in their name so warnings about missing string, vector, map, etc. are ignored? Some c-style system header includes would still be reported, but those can easily be refactored from #include <something.h> to #include <csomething>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't know.. one idea might be to write in the cfg file which headers it replace. So that no missingIncludeSystem is reported for those headers. However it might be quite a lot of headers for std,qt,posix,etc I fear.
Last edit: Daniel Marjamäki 2023-08-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have observed that cppcheck treat all headers included as
#include <...>
as system headers. This makes sense, but it is also true that people don't use<>
only for system headers. It, thus, is not good to--suppress=missingIncludeSystem
as that might hide other problems for headers that are actually not system headers. Specifying--library=std
does not help..h
in their name so warnings about missingstring
,vector
,map
, etc. are ignored? Some c-style system header includes would still be reported, but those can easily be refactored from#include <something.h>
to#include <csomething>
I don't know.. one idea might be to write in the cfg file which headers it replace. So that no missingIncludeSystem is reported for those headers. However it might be quite a lot of headers for std,qt,posix,etc I fear.
Last edit: Daniel Marjamäki 2023-08-09