>From 6b6f0f54c0eca06345b7741e5fd37b4500675286 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 10 Jul 2020 15:54:51 -0700 Subject: [PATCH] build: be less aggressive about -fanalyzer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- configure.ac | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 0afbff627..69d4e7d7f 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" -- 2.17.1