1From e64a58387db46239902b610871a0eb81626e99ff Mon Sep 17 00:00:00 2001 2From: Paul Eggert <eggert@cs.ucla.edu> 3Date: Thu, 18 Aug 2022 07:46:28 -0700 4Subject: [PATCH] Turn on -pedantic-errors at the end of 'configure' 5 6Problem reported by Khem Raj in: 7https://lists.gnu.org/r/autoconf-patches/2022-08/msg00009.html 8Upstream-Status: Submitted [https://lists.samba.org/archive/rsync/2022-August/032862.html] 9--- 10 configure.ac | 35 ++++++++++++++++++++--------------- 11 1 file changed, 20 insertions(+), 15 deletions(-) 12 13diff --git a/configure.ac b/configure.ac 14index d185b2d3..7e9514f7 100644 15--- a/configure.ac 16+++ b/configure.ac 17@@ -1071,21 +1071,6 @@ elif test x"$ac_cv_header_popt_h" != x"yes"; then 18 with_included_popt=yes 19 fi 20 21-if test x"$GCC" = x"yes"; then 22- if test x"$with_included_popt" != x"yes"; then 23- # Turn pedantic warnings into errors to ensure an array-init overflow is an error. 24- CFLAGS="$CFLAGS -pedantic-errors" 25- else 26- # Our internal popt code cannot be compiled with pedantic warnings as errors, so try to 27- # turn off pedantic warnings (which will not lose the error for array-init overflow). 28- # Older gcc versions don't understand -Wno-pedantic, so check if --help=warnings lists 29- # -Wpedantic and use that as a flag. 30- case `$CC --help=warnings 2>/dev/null | grep Wpedantic` in 31- *-Wpedantic*) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;; 32- esac 33- fi 34-fi 35- 36 AC_MSG_CHECKING([whether to use included libpopt]) 37 if test x"$with_included_popt" = x"yes"; then 38 AC_MSG_RESULT($srcdir/popt) 39@@ -1444,6 +1429,26 @@ case "$CC" in 40 ;; 41 esac 42 43+# Enable -pedantic-errors last, so that it doesn't mess up other 44+# 'configure' tests. For example, Autoconf uses empty function 45+# prototypes like 'int main () {}' which Clang 15's -pedantic-errors 46+# would reject. Generally it's not a good idea to try to run 47+# 'configure' itself with strict compiler checking. 48+if test x"$GCC" = x"yes"; then 49+ if test x"$with_included_popt" != x"yes"; then 50+ # Turn pedantic warnings into errors to ensure an array-init overflow is an error. 51+ CFLAGS="$CFLAGS -pedantic-errors" 52+ else 53+ # Our internal popt code cannot be compiled with pedantic warnings as errors, so try to 54+ # turn off pedantic warnings (which will not lose the error for array-init overflow). 55+ # Older gcc versions don't understand -Wno-pedantic, so check if --help=warnings lists 56+ # -Wpedantic and use that as a flag. 57+ case `$CC --help=warnings 2>/dev/null | grep Wpedantic` in 58+ *-Wpedantic*) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;; 59+ esac 60+ fi 61+fi 62+ 63 AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) 64 AC_OUTPUT 65 66-- 672.37.1 68 69