[Xcb] [PATCH:libxcb] Enable warnings for pre-C89 style definitions for gcc & Solaris Studio

Josh Triplett josh at joshtriplett.org
Sat Aug 3 22:00:31 PDT 2013


On Sat, Aug 03, 2013 at 08:31:20PM -0700, Alan Coopersmith wrote:
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

Reviewed-by: Josh Triplett <josh at joshtriplett.org>

> ---
> 
> As requested by Josh - when used without the previously sent patch, causes
> gcc to emit:
> 
> xcb_list.c: In function '_xcb_map_new':
> xcb_list.c:50:11: warning: old-style function definition [-Wold-style-definition]

Thanks!

> Unfortunately, xcb still has just these simple hardcoded lists of warning
> flags - if xcb ever adopts the Xorg autoconf macros, then these would have
> already been enabled by default on compilers that support them, along with
> checking for support for more warnings (including those only found in newer
> gcc versions, and tested to only enable them when available):
> 
> http://cgit.freedesktop.org/xorg/util/macros/tree/xorg-macros.m4.in#n1612

I'm all for adopting any part of those macros that will fit in XCB's
build system.

Although, ideally I'd like to see all of the unambiguous ones become
errors; while GCC might have version-dependent behavior for things like
uninitialized variable detection that prevents the safe use of -Werror
universally, using -Werror=old-style-definition and similar should prove
completely reasonable.

>  configure.ac |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7364383..6177c4b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -128,12 +128,12 @@ xcbincludedir='${includedir}/xcb'
>  AC_SUBST(xcbincludedir)
>  
>  if  test "x$GCC" = xyes ; then
> -    CWARNFLAGS="-Wall -pedantic -Wpointer-arith \
> +    CWARNFLAGS="-Wall -pedantic -Wpointer-arith -Wold-style-definition \
>  		-Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
>  else
>      AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
>      if test "x$SUNCC" = "xyes"; then
> -	CWARNFLAGS="-v"
> +	CWARNFLAGS="-v -fd"
>      fi
>  fi
>  AC_SUBST(CWARNFLAGS)
> -- 
> 1.7.9.2


More information about the Xcb mailing list