[Mesa-dev] [PATCH] mesa: Remove C++11 narrowing warnings

Kenneth Graunke kenneth at whitecape.org
Thu Aug 9 13:22:20 PDT 2012


On 08/09/2012 01:10 PM, Chad Versace wrote:
> Add -Wno-narrowing to CXXFLAGS for gcc.
> 
> This removes warnings of the form
>     warning: narrowing conversion of X from 'int' to 'float' inside { } is
>     ill-formed in C++11 [-Wnarrowing]
> in ff_fragment_shader.cpp and gen6_blorp.cpp of the form.  When building
> i965, I observed no other difference in the build output.
> 
> CC: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  configure.ac | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 89686b4..fa4fd71 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -228,6 +228,9 @@ if test "x$GXX" = xyes; then
>      # gcc's builtin memcmp is slower than glibc's
>      # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
>      CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
> +
> +    # Silence C++11 warnings that we don't care about.
> +    CXXFLAGS="$CXXFLAGS -Wno-narrowing"
>  fi
>  
>  dnl even if the compiler appears to support it, using visibility attributes isn't

Nak.  I believe this will break the build if using a g++ too old to
recognize -Wno-narrowing.  You'd need to do the whole rigamarole used in
the compiler flag checks a bit earlier.  Or import the handy m4 macro
from xorg-util-macros which does all the rigamarole in one line.


More information about the mesa-dev mailing list