CFLAG inconsistencies in xorg modular packages

Mike A. Harris mharris at mharris.ca
Mon Nov 21 15:35:02 PST 2005


Alan Coopersmith wrote:
> Some of the configure.ac's add warning flags to the CFLAGS - though
> not all the same.
> 
> This seems to be consistent across lib/X11, ICE, SM, XRes, Xau, Xfont,
> Xft, and Xpm:
> 
> if test "x$GCC" = "xyes"; then
>         GCC_WARNINGS="-Wall -Wpointer-arith -Wstrict-prototypes \
>         -Wmissing-prototypes -Wmissing-declarations \
>         -Wnested-externs -fno-strict-aliasing"
>         CFLAGS="$GCC_WARNINGS $CFLAGS"
> fi


-fno-strict-aliasing isn't a warning, it disables optimization.

However, having said that, a number of things in the tree do not compile
clean without -fno-strict-aliasing, but most of the tree is fine without
it.  I think -fno-strict-aliasing should not be used on anything unless
it works around a known bug, or if the compiler (ie: gcc4) spews out
compiler warnings about type punned pointers.

Thoughts?

> It would be nice to have it uniform across all our packages, which suggests
> another macro in our xorg-macros.m4 - something like 
> XORG_WARNING_CFLAGS(var)
> to add the appropriate flags to $var.  Most packages would probably want
> simply XORG_WARNING_CFLAGS(CFLAGS), but others may need to tweak as needed.

A uniform default makes sense to me, but it shouldn't include things
that disable optimization across the whole tree due to a few buggy
things.  Other than that it makes sense to me.



More information about the xorg-modular mailing list