如何禁止g ++中的特定警告 [英] How to supress specific warnings in 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屋!