[Mesa-dev] [PATCH] Remove CFLAGS and CXXFLAGS which clang does not support. Fixes: clang-3: warning: argument unused during compilation: '-fno-builtin-memcmp' The checks could be also done where '-fno-builtin-memcmp' become added (lines 217 and 240) but this would not remove it if set by user.

Kenneth Graunke kenneth at whitecape.org
Sat Mar 3 20:29:05 PST 2012


On 03/03/2012 08:06 AM, Johannes Obermayr wrote:
> ---
>   configure.ac |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index a2d906a..44c4e65 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1946,6 +1946,12 @@ dnl Add user CFLAGS and CXXFLAGS
>   CFLAGS="$CFLAGS $USER_CFLAGS"
>   CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
>
> +dnl Remove CFLAGS and CXXFLAGS which clang does not support
> +if test "x$acv_mesa_CLANG" = xyes; then
> +    CFLAGS=`echo $CFLAGS | sed 's/-fno-builtin-memcmp//g'`
> +    CXXFLAGS=`echo $CXXFLAGS | sed 's/-fno-builtin-memcmp//g'`
> +fi
> +
>   dnl Substitute the config
>   AC_CONFIG_FILES([configs/autoconf
>   		src/gallium/drivers/r300/Makefile

This works, but I wonder if we should instead import something like 
XORG_TESTSET_CFLAG from xorg-util-macros.  That would allow us to 
easily, in one line of code, enable flags when they're supported by the 
underlying compiler.  It would handle this and clean up a bunch of our 
other flag handling (like warning flags).

I don't think we can depend on xorg-util-macros, but we could probably 
copy part of it into Mesa.


More information about the mesa-dev mailing list