Make gcc die on init overflow of an array.
[rsync.git] / configure.ac
index e8c06f420892d61878f7eece00c7a93174e1166f..eda5f0fa17882e196e016a7ff2e7e804474733b7 100644 (file)
@@ -116,9 +116,9 @@ fi
 # I don't want our version too far out of sync.
 CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
 
-# If GCC, turn on warnings.
+# If GCC, turn on warnings and turn pedantic warnings into errors to ensure an array-init overflow is an error.
 if test x"$GCC" = x"yes"; then
-       CFLAGS="$CFLAGS -Wall -W"
+       CFLAGS="$CFLAGS -Wall -W -pedantic-errors"
 fi
 
 AC_ARG_WITH(included-popt,
@@ -1046,6 +1046,12 @@ elif test x"$ac_cv_header_popt_h" != x"yes"; then
     with_included_popt=yes
 fi
 
+if test x"$with_included_popt" = x"yes" -a x"$GCC" = x"yes"; then
+       # Our internal popt code cannot be compiled with pedantic warnings as errors, so turn off
+       # pedantic warnings.  This does not affect the array-init overflow as an error, though.
+       CFLAGS="$CFLAGS -Wno-pedantic"
+fi
+
 AC_MSG_CHECKING([whether to use included libpopt])
 if test x"$with_included_popt" = x"yes"; then
     AC_MSG_RESULT($srcdir/popt)