gsl ::抑制整个包含语句 [英] gsl::suppress whole include statements

查看:125
本文介绍了gsl ::抑制整个包含语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将准则支持库检查器"集成到我的项目中.

I am integrating Guideline Support Library Checkers into a project of mine.

Microsoft.CppCoreCheck
Microsoft.Gsl

当我运行它时,我从包括标准库,glm,boost等在内的库中得到了很多错误.

When I run it I get a bunch of errors from included libraries like standard libraries, glm, boost, etc.

一个具体的例子是SDL.h,我在sdl_stdinc.h中得到警告. 我确保仅通过我控制下的一个标头包含SDL:

One concrete example is SDL.h where I get warnings in sdl_stdinc.h. I made sure that I include SDL only via one header under my control:

ExtSDL.hpp

ExtSDL.hpp

#pragma once
#pragma warning(disable: 4710)
#pragma warning(push, 0)
#include <SDL.h>
#pragma warning(pop)

我找不到有关如何从静态代码分析中排除此库的信息.

I can not find information on how to exclude this library from the static code analysis.

推荐答案

抑制CppCoreCheck警告的方法有多种:

There are multiple ways to suppress CppCoreCheck warnings:

  • 您可以使用以下任何一种抑制CppCoreChecks [[gsl :: suppress( chapter )]]属性,其中 chapter 来自 C ++ 核心准则,例如, MS文档以获取信息
  • 您可以使用 #pragma警告如上文所述,单独或批量取消警告.
  • 您可以使用

这篇关于gsl ::抑制整个包含语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆