[MPlayer-dev-eng] [PATCH] build: Keep compiler-specific warning flags for debug and profiling builds

Diego Biurrun diego at biurrun.de
Tue Jul 16 17:32:56 CEST 2013


On 2013-07-15 00:34, Alexander Strasser wrote:
> Without warning flags like -Werror-implicit-function-declaration
> some tests like gethostname2 will compile and therefore succeed.
> But not without causing strange run-time failures later on e.g.
> when compiled for x86_64 .
>
> Having useful warning flags dropped on debug enabled builds seems
> also counter intuitive to me.
>
> This does not necessarily help with all compilers, but that can
> be fixed if those compilers have the necessary switches to be
> more strict.
>
> --- a/configure
> +++ b/configure
> @@ -2705,11 +2705,7 @@ fi # if darwin && test "$cc_vendor" = "gnu" ; then
>
>   # Checking for CFLAGS
>   _install_strip="-s"
> -if test "$_profile" != "" || test "$_debug" != "" ; then
> -  CFLAGS="-O2 $_march $_mcpu $_pipe $_debug $_profile"
> -  WARNFLAGS="-W -Wall"
> -  _install_strip=
> -elif test -z "$CFLAGS" ; then
> +if test -z "$CFLAGS" || test "$_profile" != "" || test "$_debug" != ""; then
>     if test "$cc_vendor" = "intel" ; then
>       CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer"
>       WARNFLAGS="-wd167 -wd556 -wd144"
> @@ -2725,6 +2721,12 @@ elif test -z "$CFLAGS" ; then
>       WARN_CFLAGS="-Werror-implicit-function-declaration"
>       extra_ldflags="$extra_ldflags -ffast-math"
>     fi
> +
> +  if test "$_profile" != "" || test "$_debug" != ""; then
> +    CFLAGS="-O2 $_march $_mcpu $_pipe $_debug $_profile"
> +    WARNFLAGS="-W -Wall $WARNFLAGS"
> +    _install_strip=
> +  fi
>   else
>     warn_cflags=yes
>   fi

This is far from fixing the root cause, which is that compiler flags 
handling in configure is a royal mess, but it doesn't make things worse 
for the more common gcc case.  This won't work for some or all of suncc, 
icc, clang, but they look just as broken before.

Commit if you feel like it ...

Diego


More information about the MPlayer-dev-eng mailing list