Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selectively disable C++ Core Guidelines Checker for third party libraries

I would like to try to use the Core Guidelines checker tool on a C++11/14 project, under VS2015.

In my code I use many libraries from Boost which trigger a lot of warning. I am not concerned by those warnings, since Boost is doing a lot of very clever work and the libraries were not written with the aim of conforming to the Guidelines, which they mostly predate.

But with such a flood of warnings I am unable to find out the real issues (at least according to the tool) in my code.

Is there a way to suppress all the warnings for third party code? Maybe there is some attribute before and after #including boost headers?

I have read this page from the Visual C++ Team blog but I have been unable to find it.

like image 701
Francesco Avatar asked Aug 20 '17 17:08

Francesco


1 Answers

There's an undocumented environment variable, CAExcludePath, that filters warnings from files in that path. I usually run with %CAExcludePath% set to %Include%.

You can also use it from MSBuild, see here for an example (with mixed success): Suppress warnings for external headers in VS2017 Code Analysis

MSVC is working on something similar to GCC's system headers that should be a more comprehensive solution to this problem.

like image 98
apardoe Avatar answered Sep 28 '22 08:09

apardoe