Mesa (master): mesa: Remove C++11 narrowing warnings

Chad Versace chadversary at kemper.freedesktop.org
Fri Aug 10 17:00:49 UTC 2012


Module: Mesa
Branch: master
Commit: 9f5a5d541d5c1ff2e440791ba8ff44d0233daeb4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f5a5d541d5c1ff2e440791ba8ff44d0233daeb4

Author: Chad Versace <chad.versace at linux.intel.com>
Date:   Thu Aug  9 12:59:22 2012 -0700

mesa: Remove C++11 narrowing warnings

Add -Wno-narrowing to CXXFLAGS for gcc.

It is safe to add this flag even for versions of gcc that don't recognize
it.  From the GCC Manual [1]: "[GCC] allows the use of new -Wno- options
with old compilers".

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.

[1] http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>

---

 configure.ac |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

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




More information about the mesa-commit mailing list