We have always recommended that headers are not checked directly.. instead the sourcefiles that include the headers should be checked. Checking headers directly has always resulted in false positives and wrong configurations etc.
If the user wants to check a header file, it is recommended that some source files that #include the header are checked instead. Cppcheck could do this automatically - whenever a header file is given, look up source files that include it directly or indirectly and check those.
I am a bit worried that we will break some script if we do this. Should it be possible to select behaviour with some command line flag?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do not think that this is a good idea. If a user wants to check a header, cppcheck should check the header. Anything else would be confusing. And it would not work well anyway if some header-only library should be checked.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Wild idea..
We have always recommended that headers are not checked directly.. instead the sourcefiles that include the headers should be checked. Checking headers directly has always resulted in false positives and wrong configurations etc.
If the user wants to check a header file, it is recommended that some source files that #include the header are checked instead. Cppcheck could do this automatically - whenever a header file is given, look up source files that include it directly or indirectly and check those.
I am a bit worried that we will break some script if we do this. Should it be possible to select behaviour with some command line flag?
I do not think that this is a good idea. If a user wants to check a header, cppcheck should check the header. Anything else would be confusing. And it would not work well anyway if some header-only library should be checked.
It could be handy for some header-base libraries; IMHO, some kind of flag could be usefull