detecting when an option is not available

Ian Lance Taylor iant@google.com
Tue Jun 12 05:44:00 GMT 2012


Vincent Torri <vtorri@univ-evry.fr> writes:

> I would like to know if there is a way to know if a warning option
> like -Wno-initializer-overrides is supported or not by gcc. My purpose
> is to write an m4 macro that checks if an option is supported or not
> by a compiler.

This question is not appropriate for the mailing list gcc@gcc.gnu.org,
which is for the development of GCC itself.  It would be appropriate on
the mailing list gcc-help@gcc.gnu.org.  Please take any followups to
gcc-help.  Thanks.


The trick to find out if a -Wno- option is supported is to force a
compiler error.  E.g.,

echo xx | gcc -Wno-initializer-overrides -x c - -c 2>&1 | grep 'unrecognized command line option'

Ian



More information about the Gcc mailing list