]> Savannah Git Hosting - gnulib.git/commitdiff
warnings: Save memory and CPU time when inhibiting all warnings.
authorBruno Haible <bruno@clisp.org>
Mon, 12 Jun 2023 12:00:42 +0000 (14:00 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 12 Jun 2023 12:00:42 +0000 (14:00 +0200)
* 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.

ChangeLog
m4/warnings.m4

index cdca04ff5b4b3148f1448fa628dd4b5ed8ef929f..32b21f1a932ce15fb860baa942293f52c94be5f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-06-12  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        javacomp-script, javacomp: Document effects of yesterday's change.
index 1a3107f846d5c501cb42c0d72cfaccd800885255..9433cb523bf51fdda40eb07d52a14d39e9d2a8aa 100644 (file)
@@ -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=''