且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

对不兼容的选项禁用gcc警告

更新时间:2022-10-15 17:26:02

在我看来,如果有这样一个选项,就必须有另一个选项来关闭警告该选项,等等无限。所以我怀疑没有。



有完全不同语言版本的相同选项似乎有点奇怪 - 我会有不同的选项定义为makefile宏,并适用于不同的目标。


I'm curious if there is an option to disable gcc warnings about a parameter not being valid for the language being compiled.

Ex:

cc1: warning: command line option "-Wno-deprecated" is valid for C++/Java/ObjC++ but not for C

Our build system passes the warnings we have decided on globally across a build. We have both C/C++ code and the warnings get real annoying when trying to find actual warnings.

Any suggestions?

It seems to me that if there were such an option, there would have to be a further option to turn off warnings about that option, and so on infinitely. So I suspect there isn't.

Having the same options for builds of completely different languages seems a bit odd anyway - I would have different options defined as makefile macros and used appropriately for different targets.