How to exclude library headers from my static analysis of Visual Studio code?

I have setup build to compile my Qt / C ++ application with the / analysis flag.

However, the analysis also delves into qt headers that don't bother me:

c:\qt\qt-everywhere-opensource-src-4.8.1\src\corelib\tools\qvector.h(547) : warning C6011: Dereferencing NULL pointer 'x.p': Lines: 474, 475, 476, 477, 478, 480, 491, 493, 497, 498, 499, 500, 503, 504, 518, 519, 520, 521, 522, 525, 545, 547 

What is the best way to exclude these files in bulk?

(Note that I am not using an IDE; I am looking for a command line, switch, or code change)

+7
source share
1 answer

You can disable all code analysis warnings for a specific block of code using the #pragma warning in your code. MSDN provides the following example:

 #include <codeanalysis\warnings.h> #pragma warning( push ) #pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS ) #include <third-party include files here> #pragma warning( pop ) 

(see "How to enable and disable code analysis for specific C / C ++ warnings" for more information.)

As far as I know, there is no way to disable warnings from specific header files using only command line options.

+8
source

All Articles