Disable gcc warning for incompatible options

I am wondering if it is possible to disable gcc warnings about an invalid parameter for the compiled language.

Example:

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

Our build system transmits warnings that we have accepted around the world throughout the build. We have C / C ++ code, and warnings become annoying when trying to find actual warnings.

Any suggestions?

+5
source share
5 answers

It seems to me that if there was such an option, one more option would be to turn off warnings about this parameter and so on endlessly. Therefore, I suspect not.

- , makefile .

+2

gcc -Wxxxx -Wno-xxxx.

GCC:

, -W', for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning -Wno- ', ; , -Wno-implicit. , , .

@Neil . make, , . C CFLAGS ++ CCFLAGS.

+3

CFLAGS, C, CXXFLAGS, ++, .

+2

, gcc . , , , .

, , ? , , , .

For your build system, you can define separate warning sets for different languages. What happens if you need to use some other compiler and not gcc?

0
source

When compiling your C files like C ++ is for you option -x c++.

0
source

All Articles