From: Bruno Haible Date: Mon, 12 Jun 2023 12:00:42 +0000 (+0200) Subject: warnings: Save memory and CPU time when inhibiting all warnings. X-Git-Tag: v1.0~1218 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c65c0c39cd4f75fde4b855c93ac30879e0beedaf;p=gnulib.git warnings: Save memory and CPU time when inhibiting all warnings. * m4/warnings.m4 (gl_WARN_ADD): Improve comments. (gl_CC_INHIBIT_WARNINGS): Add also '-fno-analyzer' to GL_CFLAG_INHIBIT_WARNINGS. (gl_CXX_INHIBIT_WARNINGS): Add also '-fno-analyzer' to GL_CXXFLAG_INHIBIT_WARNINGS. --- diff --git a/ChangeLog b/ChangeLog index cdca04ff5b..32b21f1a93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-06-12 Bruno Haible + + warnings: Save memory and CPU time when inhibiting all warnings. + * m4/warnings.m4 (gl_WARN_ADD): Improve comments. + (gl_CC_INHIBIT_WARNINGS): Add also '-fno-analyzer' to + GL_CFLAG_INHIBIT_WARNINGS. + (gl_CXX_INHIBIT_WARNINGS): Add also '-fno-analyzer' to + GL_CXXFLAG_INHIBIT_WARNINGS. + 2023-06-11 Bruno Haible javacomp-script, javacomp: Document effects of yesterday's change. diff --git a/m4/warnings.m4 b/m4/warnings.m4 index 1a3107f846..9433cb523b 100644 --- a/m4/warnings.m4 +++ b/m4/warnings.m4 @@ -1,4 +1,4 @@ -# warnings.m4 serial 18 +# warnings.m4 serial 19 dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -81,12 +81,14 @@ AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL], # gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS/WARN_CXXFLAGS], # [PROGRAM = AC_LANG_PROGRAM()]) # ----------------------------------------------------------- -# Adds parameter to WARN_CFLAGS/WARN_CXXFLAGS if the compiler supports it -# when compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]). +# Adds OPTION to VARIABLE (which defaults to WARN_CFLAGS or WARN_CXXFLAGS) +# if the compiler supports it when compiling PROGRAM. # # If VARIABLE is a variable name, AC_SUBST it. # # The effects of this macro depend on the current language (_AC_LANG). +# +# Example: gl_WARN_ADD([-Wparentheses]). AC_DEFUN([gl_WARN_ADD], [AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)]) gl_COMPILER_OPTION_IF([$1], @@ -123,7 +125,12 @@ AC_DEFUN([gl_CC_INHIBIT_WARNINGS], ]) case "$gl_cv_cc_winhibit" in none) GL_CFLAG_INHIBIT_WARNINGS='' ;; - *) GL_CFLAG_INHIBIT_WARNINGS="$gl_cv_cc_winhibit" ;; + *) + GL_CFLAG_INHIBIT_WARNINGS="$gl_cv_cc_winhibit" + dnl If all warnings are inhibited, there's no point in having the GCC + dnl analyzer enabled. This saves RAM requirements and CPU consumption. + gl_WARN_ADD([-fno-analyzer], [GL_CFLAG_INHIBIT_WARNINGS]) + ;; esac AC_SUBST([GL_CFLAG_INHIBIT_WARNINGS]) ]) @@ -150,7 +157,12 @@ AC_DEFUN([gl_CXX_INHIBIT_WARNINGS], ]) case "$gl_cv_cxx_winhibit" in none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;; - *) GL_CXXFLAG_INHIBIT_WARNINGS="$gl_cv_cxx_winhibit" ;; + *) + GL_CXXFLAG_INHIBIT_WARNINGS="$gl_cv_cxx_winhibit" + dnl If all warnings are inhibited, there's no point in having the GCC + dnl analyzer enabled. This saves RAM requirements and CPU consumption. + gl_WARN_ADD([-fno-analyzer], [GL_CXXFLAG_INHIBIT_WARNINGS]) + ;; esac else GL_CXXFLAG_INHIBIT_WARNINGS=''