Question

I've set up CPPCheck (v1.6.1) for a large project containing a bunch of libraries.

When I check a library then I get some check failures which I'm interested in and all is well. However at this point I just have a text file list of all the *.cpp and *.h in that library which I'm passing by '--file-list=...'

Of course, I do get some errors about missing includes, because this library (say MyLibA) includes files from another one of my libraries (MyLibB).

So I now construct a text file that has all the include paths from MyLibB and pass it to cppcheck via '--includes-file=...'.

At this point I get some cpp failures about headers within MyLibB, which is not unexpected, however all the errors that were reported about MyLibA are no longer reported.

Is this a bug or am I doing something wrong?

Was it helpful?

Solution

If cppcheck runs into a #error then it aborts the check. So you can end up in the situation whereby including headers triggers a #error (if for example you haven't correctly set up your -D preprocessor defines for cppcheck on the command line).

This means that files that were checked previously will no longer get checked because the tests were aborted in the header, i.e. before the offending lines of code were reached

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top