Menu

A good way to suppress missingIncludeSystem

2023-08-09
2023-08-09
  • Samuel Poláček

    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.

    1. Is it possible for Cppcheck to be aware of which header it does not need any information so it would not print the warning?
    2. 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>
     
  • Daniel Marjamäki

    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

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.