How do I exclude library headers from my Visual Studio static code analysis?

前端 未结 1 1268
野的像风
野的像风 2021-02-13 09:44

I have setup buildbot to compile my Qt/C++ application with the /analyze flag.

However the analysis is also delving into the qt headers which I don\'t care about:

<
相关标签:
1条回答
  • 2021-02-13 10:33

    You can disable all code analysis warnings for a particular block of code using #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.)

    To the best of my knowledge, there is no way to disable warnings from particular header files using only command line options.

    0 讨论(0)
提交回复
热议问题