Re: [PATCH 2/2] configure : fix unrecognized -Wno option
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <1338628182.317545434.1350817146726.JavaMail.root@zimbra33-e6.priv.proxad.net> |
----- Mail original ----- > De: "Chris Wilson" <[email protected]> > À: "Gilles Espinasse" <[email protected]>, [email protected] > Envoyé: Dimanche 21 Octobre 2012 10:40:50 > Objet: Re: [cairo] [PATCH 2/2] configure : fix unrecognized -Wno option > > On Sat, 20 Oct 2012 20:22:51 +0200, Gilles Espinasse <[email protected]> > wrote: > > Signed-off-by: Gilles Espinasse <[email protected]> > > > > gcc-4.4 and later accept every -Wno option > > Test for the option without no in the name to check if the option > > is supported. > > > > Each time a warning is emitted and without this fix, on gcc-4.4 > > that will add this warning: > > cc1: warning: unrecognized command line option > > "-Wno-unused-but-set-variable" > > I'm not convinced this is the best approach, it seems fragile to assume > that GCC will accept all -Wno options. Could we not improve the > detection of an unsupported flag instead? If it requires a warning to > generate the spurious warning, maybe we should just fill the test > code with junk... > > The other question is which is the lesser evil? > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre > This behavior is described in gcc-4.4 announce http://gcc.gnu.org/gcc-4.4/changes.html and on later versions in the manual http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html#Warning-Options A new option has even be added after gcc-4.4 to control that behavior with -Wunknown-warning/-Wno-unknown-warning but as this new option is not know on gcc-4.4, the new option can't be used there unless using the same trick aka test if -Wunknown-warning is supported and use -Wno-unknown-warning. So there is actually no gain with that option until the last supported compiler know this new option. Detection was made in a similar way in openssh(portable) or using makefile in linux/scripts/Kbuild.include with # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) Gilles -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo