如何在g ++中抑制特定的警告 [英] How to suppress specific warnings in g++

查看:134
本文介绍了如何在g ++中抑制特定的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想抑制g ++的特定警告。我知道 -Wno-XXX 标志,但我正在寻找更具体的东西。我想在 -Weffc ++ 一些的警告,但不是全部。就像你可以用lint做的一样 - 禁用特定的消息。

I want to suppress specific warnings from g++. I'm aware of the -Wno-XXX flag, but I'm looking for something more specific. I want some of the warnings in -Weffc++, but not all of them. Something like what you can do with lint - disable specific messages.

在gcc中有内置的方法来执行此操作吗?我必须编写一个包装脚本吗?

Is there a built in way in gcc to do this? Do I have to write a wrapper script?

推荐答案

不幸的是,这个功能并不是由g ++提供的。在VC ++中,您可以使用 #pragma warning 禁用一些特定的警告。在gcc中,您可以找到最接近的诊断编译指示,它可让您启用/禁用特定文件或项目的某些类型的诊断。

Unfortunately, this feature isn't provided by g++. In VC++, you could use #pragma warning to disable some specific warnings. In gcc, the closest you can have is diagnostic pragmas, which let you enable/disable certain types of diagnostics for certain files or projects.

这篇关于如何在g ++中抑制特定的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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