Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cppcheck: how to skip a directory of third party header files?

Tags:

I call cppcheck on our own files in our source base. However, some source files include header files from third party libraries, say from ./lib/some_library/. These are automatically parsed by cppcheck as well.

I don't want this, since I don't want to see warnings on third party code. Is there a way to get around this?

The difference with how can i tell cppcheck to skip a header file is that this post explicitly asks for skipping an entire directory, not just an individual header file.

like image 809
chtenb Avatar asked Jun 03 '16 08:06

chtenb


1 Answers

Another possibility would be to use suppressions via a file (see manual chapter 7 "Listing suppressions in a file") or via commandline.

Your suppressions.txt could be

*:/path/to/your/thirdpartylibs/*

Which would exclude all errors from that path. The syntax is

[error id]:[filename]:[line]

with wildcard support for * (multiple characters) and ? (single character).

The call to cppcheck would then be

cppcheck --suppressions-list=suppressions.txt . 
like image 94
BNT Avatar answered Sep 16 '22 11:09

BNT