From: Paul Eggert Date: Fri, 10 Jul 2020 22:54:51 +0000 (-0700) Subject: build: be less aggressive about -fanalyzer X-Git-Tag: v9.0~216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b6f0f54c0eca06345b7741e5fd37b4500675286;p=thirdparty%2Fcoreutils.git build: be less aggressive about -fanalyzer * configure.ac: Don’t enable -fanalyzer unless configured with the new --enable-gcc-warnings=expensive option. See thread at: https://lists.gnu.org/r/coreutils/2020-07/msg00011.html --- diff --git a/configure.ac b/configure.ac index 0afbff6271..69d4e7d7ff 100644 --- a/configure.ac +++ b/configure.ac @@ -89,10 +89,14 @@ AC_DEFUN([gl_GCC_VERSION_IFELSE], ) AC_ARG_ENABLE([gcc-warnings], - [AS_HELP_STRING([--enable-gcc-warnings], - [turn on many GCC warnings (for developers; best with GNU make)])], + [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@], + [control generation of GCC warnings. The TYPE 'no' disables + warnings (default for non-developer builds); 'yes' generates + cheap warnings if available (default for developer builds); + 'expensive' in addition generates expensive-to-compute warnings + if available.])], [case $enableval in - yes|no) ;; + no|yes|expensive) ;; *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; esac gl_gcc_warnings=$enableval], @@ -108,12 +112,18 @@ AC_ARG_ENABLE([gcc-warnings], && gl_gcc_warnings=yes])] ) -if test "$gl_gcc_warnings" = yes; then +if test $gl_gcc_warnings != no; then gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) AC_SUBST([WERROR_CFLAGS]) - nw= + ew= + AS_IF([test $gl_gcc_warnings != expensive], + [# -fanalyzer and related options slow GCC considerably. + ew="$ew -fanalyzer -Wno-analyzer-double-free -Wno-analyzer-malloc-leak" + ew="$ew -Wno-analyzer-null-dereference -Wno-analyzer-use-after-free"]) + # This, $nw, is the list of warnings we disable. + nw=$ew nw="$nw -Wdeclaration-after-statement" # too useful to forbid nw="$nw -Waggregate-return" # anachronistic nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h) @@ -190,7 +200,7 @@ if test "$gl_gcc_warnings" = yes; then # We use a slightly smaller set of warning options for lib/. # Remove the following and save the result in GNULIB_WARN_CFLAGS. - nw= + nw=$ew nw="$nw -Wduplicated-branches" # Too many false alarms nw="$nw -Wformat-truncation=2" nw="$nw -Wstrict-overflow"