[PATCH util-macros 1/2] Don't disable strict aliasing (-fno-strict-aliasing) globally
Patrick Horgan
phorgan1 at yahoo.com
Tue Nov 2 17:06:49 PDT 2010
On 11/01/2010 02:46 PM, Gaetan Nadon wrote:
...elision by patrick ...
> Sorry, I got confused. I forgot -O brings strict
> aliasing by default. We need one new variable for
> "real warnings" and one variable for
> -fno-strict-aliasing. Modules would typically use the
> new "real warnings" variable and some would pick the
> new "-fno-strict-aliasing
> " variable (the server and drivers for example). The
> CWARNFLAGS is untouched for backward compatibility. I
> hope I got it right :-)
>
> For the server, it would be $(CFLAGS_WARNINGS) +
> $(CFLAGS_NO_STRICT_ALIASING)
> For libXxf86vm, it would be $(CFLAGS_WARNINGS)
While it can be annoying in low level code to write the
unions that let you keep strict-aliasing, it's worth
it. gcc generates much better code with the unions in
place EVEN without optimization turned on. It gives
the compiler more information about the code that it
can use to generate better code. I'd recommend to fix the
*dereferencing type-punned pointer will break
strict-aliasing rules
*
**warnings generated by having -Wall turned on (or
really by having -Wstrict-aliasing turned on by
-Wall). Some will say, "but it's annoying", but better
code is better code.
Patrick
More information about the xorg-devel
mailing list