Dinesh
Dinesh

Reputation: 21

Please tell me about the uses or working of cppcheck after including the header files for analysis

Please tell me the differences with/without header files during the cppcheck's analysis.

Actually i am integrating cppcheck's report with sonar, will sonar's dashboard will contain any differences?

After including header files, it took 5 days(approx) complete the analysis, even though i used -j 4 and max-config to 2 options.

And confused that, the LOC has reduced after including header files for analysis. and i could see the functions , classes are reduced to few numbers.

Does cppcheck errors on header files? if yes, what rules are applied on it? where can i find this info, thw rules that are associated with header files?

Please help.

thanks, Dinesh

Upvotes: 2

Views: 365

Answers (1)

Daniel Marjamäki
Daniel Marjamäki

Reputation: 3037

I am a Cppcheck developer.

It's not a technically trivial question if you should include headers or not. There are both benefits and drawbacks with headers for the analysis. Better type information is a good thing. Expanding macros might be a bad thing.

In case you wonder; the same checkers will be used no matter if headers are included or not. It's just that the input data is not always better when all headers are included.

I certainly recommend that you don't include any standard headers. stdio,string,stl,etc.

I personally normally don't include various system headers. I would prefer to create a cfg file instead if I use a library. That will give Cppcheck better information about the library than the headers.

I normally try to include local headers in the project. Use -I to add good paths in the project.

Upvotes: 5

Related Questions