[PATCH xserver 1/4] Replace deprecated CWARNFLAGS with BASE_CFLAGS and NO_STRICT_ALIASING_CFLAG

Gaetan Nadon memsize at videotron.ca
Fri Dec 9 08:32:39 PST 2011


On Fri, 2011-12-09 at 07:40 -0800, Keith Packard wrote:

> On Fri, 09 Dec 2011 07:45:01 -0500, Gaetan Nadon <memsize at videotron.ca> wrote:
> 
> >  This function is deprecated because it defines -fno-strict-aliasing
> >  which alters the code generated by the compiler.  If -fno-strict-aliasing
> >  is needed, then it should be added explicitly in the module when
> >  it is updated to use BASE_CFLAGS.
> 
> Does this change the default for this flag? -fno-strict-aliasing is
> needed to preserve compatibility with older code, and I think it should
> probably be on by default until a module owner disables it manually.
> 

The content for CWARNFLAGS will always contain -fno-strict-aliasing.

        # XORG_CWARNFLAGS
        # ---------------
        # Minimum version: 1.2.0
        # Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
        #
        # Defines CWARNFLAGS to enable C compiler warnings.
        #
        # This function is deprecated because it defines -fno-strict-aliasing
        # which alters the code generated by the compiler.  If -fno-strict-aliasing
        # is needed, then it should be added explicitly in the module when
        # it is updated to use BASE_CFLAGS.
        #
        AC_DEFUN([XORG_CWARNFLAGS], [
        AC_REQUIRE([XORG_COMPILER_FLAGS])
        AC_REQUIRE([XORG_COMPILER_BRAND])
        CWARNFLAGS="$BASE_CFLAGS"
        if  test "x$GCC" = xyes ; then
            CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
        fi
        AC_SUBST(CWARNFLAGS)
        ]) # XORG_CWARNFLAGS


An alternative is now available which separates the warning flags from
-fno-strict-aliasing. In the xserver configuration file, CWARNFLAGS has
been replaced with:

        XORG_TESTSET_CFLAG([NO_STRICT_ALIASING_CFLAG], [-fno-strict-aliasing])
        XSERVER_CFLAGS='$(BASE_CFLAGS) $(NO_STRICT_ALIASING_CFLAG)'
        AC_SUBST([NO_STRICT_ALIASING_CFLAG])


which is equivalent to CWARNFLAGS in terms of -fno-strict-aliasing.

This separation allows (many) modules who do not want
-fno-strict-aliasing to get the warning flags only. I originally thought
that CWARNFLAGS would fall behind in terms of warning flags (past
discussions), but I just noticed Jeremy reimplemented it such that it
will be updated whenever the BASE_CFLAGS variable is updated. It isn't
as deprecated as the comment says.

Thanks for talking a look at this.








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111209/7609ac9c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111209/7609ac9c/attachment-0001.pgp>


More information about the xorg-devel mailing list