configure: Disable bogus array bounds warnings with -Wall.

Michael Stefaniuc mstefani at redhat.de
Wed Oct 19 18:01:11 CDT 2011


---
I kept ignoring those warnings until now but having to touch header
files makes them extremely annoying.



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

diff --git a/configure.ac b/configure.ac
index 363d08f..a162b04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1711,6 +1711,17 @@ then
     EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"
   fi
 
+  dnl Check for noisy -Warray-bounds enabled with -Wall
+  saved_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Wall -Werror"
+  AC_CACHE_CHECK([for bogus -Warray-bounds warnings generated with -Wall], ac_cv_c_arraybounds_noisy,
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct tag_a{char a[[1]];}; char buf[[sizeof(struct tag_a) + 256]];]], [[struct tag_a *p = (struct tag_a *)buf; p->a[[2]] = 'a';]])],[ac_cv_c_arraybounds_noisy=no],[ac_cv_c_arraybounds_noisy=yes]))
+  CFLAGS="$saved_CFLAGS"
+  if test "$ac_cv_c_arraybounds_noisy" = "yes"
+  then
+    EXTRACFLAGS="$EXTRACFLAGS -Wno-array-bounds"
+  fi
+
   dnl Enable -Werror for maintainer mode
   if test "x$enable_maintainer_mode" = "xyes"
   then
-- 
1.7.6.4



More information about the wine-patches mailing list