[PATCH util-macros] Transfer -fno-strict-aliasing from XORG_CWARNFLAGS to modules

Gaetan Nadon memsize at videotron.ca
Mon Feb 22 05:33:43 PST 2010

This macro was introduced in commit 4cce4c8169a252bce129411dbf70c3212974e7ca.
It contains -W* flags to produce warnings. However the -fno-strict-aliasing
option is also present which is not related to compiler warnings.

This option suppresses compiler optimization based on strict aliasing rules
defined in the C language. This optimization is done by default with the -O2

Many modules included the macro without the knowledge that this optimization
was suppressed. There is a good number of modules who do not yet include this
macro but that should, in order to get (only) warning flags.

There are modules who could benefit from this optimization, particularly
on non-GNU compilers and embedded systems. It is best to leave the
decision to each module.

This patch is one of the patches that will transfer the responsibility of
selecting appropriate optimization to the module. All X.Org modules using
this macro have been reviewed and patches have been submitted concurrently
to this one. The goal is to preserve the current level of optimization,
not to determine what it should be.

The modules that did not have -fno-strict-aliasing at the time where CWARNFLAGS
was introduced will not be patched with -fno-strict-aliasing.

The following modules have been determined to not have contained the option
prior to it's introduction through the macro. There is therefore no need to
submit a patch to add the option.

appres bdftopcf beforelight bitmap editres fonttosfnt fslsfonts fstobdf
iceauth ico listres luit mkcomposecache mkfontscale oclock rendercheck
rgb rstart  sessreg setxkbmap showfont smproxy viewres x11perf xauth
xbacklight xbiff xcalc xclipboard xclock xcmsdb xconsole xcursorgen
xdbedizzy xdm xdpyinfo xdriinfo xedit xev xeyes xf86dga xfd xfontsel
xfs xfsinfo xgamma xgc xhost xinit xkbcomp xkbevd xkbprint xkbutils
xkill xload xlogo xlsatoms xlsclients xlsfonts xmag  xman xmessage xmh
xmodmap xmore xprop xrandr xrdb xrefresh xscope xset xsetmode xsetpointer
xsetroot xsm xstdcmap xvidtune xvinfo xwd xwininfo xwud

input-acecad input-aiptek input-evdev input-joystick input-keyboard
input-mouse input-wacom video-cirrus video-mach64 video-qxl

libAppleWM libdmx libfontenc libFS libpciaccess libWindowsWM libXaw
libXcomposite libXcursor libXdamage libXdmcp libXext libXfixes libXi
libXinerama libxkbfile libXmu libXrandr libXrender libXScrnSaver libXt
libXtst libXv libXvMC libXxf86dga

A new warning has been added (-Wstrict-aliasing=2) which will help find
code that may interfere with optimization.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
 xorg-macros.m4.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 26b7565..ca85f14 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -877,7 +877,7 @@ AC_DEFUN([XORG_CWARNFLAGS], [
 if  test "x$GCC" = xyes ; then
     CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
--Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
+-Wmissing-declarations -Wnested-externs -Wstrict-aliasing=2 \
 -Wbad-function-cast -Wformat=2"
     case `$CC -dumpversion` in
     3.4.* | 4.*)

More information about the xorg-devel mailing list