[Mesa-dev] [PATCH] mesa: Remove C++11 narrowing warnings
Chad Versace
chad.versace at linux.intel.com
Mon Aug 20 13:52:04 PDT 2012
Add -Wno-narrowing to CXXFLAGS if gcc supports it.
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. When building i965,
I observed no other difference in the build output.
CC: Kenneth Graunke <kenneth at whitecape.org>
CC: Matthew Turner <matts88 at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
configure.ac | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index fcfe085..89b8fe7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,7 +219,17 @@ if test "x$GXX" = xyes; then
[VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
AC_LANG_POP([C++])
- # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
+ # Enable -Wno-narrowing if using a gcc that supports it.
+ save_CXXFLAGS="$CXXFLAGS"
+ WNO_NARROWING_CXXFLAGS="-Wno-narrowing"
+ AC_MSG_CHECKING([whether $CXX supports $WNO_NARROWING_CXXFLAGS])
+ CXXFLAGS="$CXXFLAGS $WNO_NARROWING_CXXFLAGS"
+ AC_LANG_PUSH([C++])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
+ [WNO_NARROWING_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
+ AC_LANG_POP([C++])
+
+ # Restore CXXFLAGS. The flags probed above are added where needed.
CXXFLAGS=$save_CXXFLAGS
# Work around aliasing bugs - developers should comment this out
@@ -244,6 +254,7 @@ esac
AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([VISIBILITY_CXXFLAGS])
+AC_SUBST([WNO_NARROWING_CXXFLAGS])
dnl
dnl Hacks to enable 32 or 64 bit build
--
1.7.11.4
More information about the mesa-dev
mailing list