Merge branch 'master' of git.sv.gnu.org:/srv/git/mit-scheme
authorChris Hanson <org/chris-hanson/cph>
Fri, 9 Nov 2018 06:46:09 +0000 (22:46 -0800)
committerChris Hanson <org/chris-hanson/cph>
Fri, 9 Nov 2018 06:46:09 +0000 (22:46 -0800)
1  2 
src/microcode/configure.ac

index b69e23bcd4b7db885f3ddefe573442fb59a3e37e,1c4babf26afbfcb56a8eb4855f7d7d6df13166e4..ff2ab757d24ed09af4b9eaa8628b45ad7d318848
@@@ -202,39 -202,51 +202,54 @@@ if test x"${GCC}" = xyes; the
      CFLAGS=${SAVED_CFLAGS}
      LDFLAGS=${SAVED_LDFLAGS}
  
 -    if test ${enable_debugging} = no; then
 +    if test x"${enable_debugging}" = xno; then
        CFLAGS="-O3 ${CFLAGS}"
      else
 -      CFLAGS="-O0 -g -DENABLE_DEBUGGING_TOOLS ${CFLAGS}"
 +        if test x"${enable_debugging}" = xyes; then
 +            CFLAGS="-DENABLE_DEBUGGING_TOOLS ${CFLAGS}"
 +        fi
 +      CFLAGS="-O0 -g ${CFLAGS}"
        LDFLAGS="${LDFLAGS} -g"
      fi
-     CFLAGS="-Wall -Wundef -Wpointer-arith -Winline ${CFLAGS}"
-     CFLAGS="-Wstrict-prototypes -Wnested-externs -Wredundant-decls ${CFLAGS}"
-     AC_MSG_CHECKING([for GCC>=4])
-     AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-           #if __GNUC__ >= 4
-           ;
-           #else
-           #error "gcc too old"
-           #endif
-           ]],
-           [[]]
-       )],
-       [
-       AC_MSG_RESULT([yes])
-       CFLAGS="-Wextra -Wno-sign-compare -Wno-unused-parameter ${CFLAGS}"
-       CFLAGS="-Wold-style-definition ${CFLAGS}"
-       ],
-       [AC_MSG_RESULT([no])])
+     CFLAGS_WERROR=-Werror
+     for flag in \
+       -Wall \
+       -Wclobbered \
+       -Wempty-body \
+       -Wignored-qualifiers \
+       -Wimplicit-fallthrough \
+       -Winline \
+       -Wmissing-field-initializers \
+       -Wmissing-parameter-type \
+       -Wnested-externs \
+       -Wold-style-declaration \
+       -Woverride-init \
+       -Wpointer-arith \
+       -Wredundant-decls \
+       -Wshift-negative-value \
+       -Wstrict-prototypes \
+       -Wtype-limits \
+       -Wundef \
+       -Wuninitialized \
+       -Wunreachable-code \
+       -Wwrite-strings \
+       \
+       -Wno-error=stringop-truncation \
+       ; do
+       AC_MSG_CHECKING([for compiler warning $flag])
+       SAVED_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS $flag"
+       AC_TRY_COMPILE([],[],
+           [AC_MSG_RESULT(yes)],
+           [AC_MSG_RESULT(no)
+           CFLAGS="$SAVED_CFLAGS"])
+     done
  
      # other possibilities:
-     # -Wmissing-prototypes -Wunreachable-code -Wwrite-strings
+     # -Wmissing-prototypes (requires prototypes for DEFINE_PRIMITIVE)
+     # -Wstringop-truncation (requires it to not whine about correct use
+     #  of strncpy for buffers that are _not_ null-terminated)
  fi
  FOO=`${INSTALL} --help 2> /dev/null | ${FGREP} -e --preserve-timestamps`
  if test "x${FOO}" != x; then