CFLAG inconsistencies in xorg modular packages

Alan Coopersmith Alan.Coopersmith at Sun.COM
Sun Nov 20 11:46:09 PST 2005


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

xserver/xorg has:
         if test "x$GCC" = "xyes"; then
                 GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
                 GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
                 GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
                 GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
                 if test "x$WERROR" = "xyes"; then
                         GCC_WARNINGS="${GCC_WARNINGS} -Werror"
                 fi
                 XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
                 LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
         fi

But none of the rest have any extra settings.

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.

It would add the above set for gcc, "-v" for Sun cc, and nothing for other
compilers (though support for Intel compilers or USLC or other compilers
could be added, as could tests for compiler versions to use newer flags).
We could also include the WERROR environment check to allow builders to
turn warnings into errors.  (-Werror for gcc, -errwarn for sun cc)

We could also add XORG_SECURITY_FLAGS(var) to set flags like -fPIE (bug #2730)
for apps we know run with high privelege level and/or open network ports.

Does this seem like something that people would like to see happen?   Should
we try to get it in the next RC?   Are there any additional flags other than
the warning controls and security flag that are uniformly needed across all
our packages?    (Someday a C99 macro to enable/enforce C99 mode might be 
nice, but that's not for this release.)

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering


More information about the xorg-modular mailing list