]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
manywarnings: omit new C warning for GCC < 15
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jan 2026 20:26:22 +0000 (12:26 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jan 2026 20:43:36 +0000 (12:43 -0800)
Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2026-01/msg00135.html
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)):
Do not add -Wzero-as-null-pointer-constant for GCC < 15.
Also, accept strings like "gcc-14 (Ubuntu 14.3.0-8ubuntu1) 14.3.0"
as specifying GCC versions like 14.3.0.

ChangeLog
m4/manywarnings.m4

index bd77658a749602ffbdf0f0933937742a3661f0a3..c880440831fe1c8919ccf1fee77006dbef1cf0cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2026-01-16  Paul Eggert  <eggert@cs.ucla.edu>
 
+       manywarnings: omit new C warning for GCC < 15
+       Problem reported by Pádraig Brady in:
+       https://lists.gnu.org/r/bug-gnulib/2026-01/msg00135.html
+       * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)):
+       Do not add -Wzero-as-null-pointer-constant for GCC < 15.
+       Also, accept strings like "gcc-14 (Ubuntu 14.3.0-8ubuntu1) 14.3.0"
+       as specifying GCC versions like 14.3.0.
+
        selinux-h: pacify -Wzero-as-null-pointer-constant
        * lib/se-context.in.h (context_t): Make it a pointer to an
        incomplete type rather than an int, so that callers can initialize
index 97567b2530c0ecedbd55ca3584289891c71d7ee4..4cb17a689a7ae751290d5545f16a35fa4eba9616 100644 (file)
@@ -1,5 +1,5 @@
 # manywarnings.m4
-# serial 30
+# serial 31
 dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -150,7 +150,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
     -Wvector-operation-performance \
     -Wvla \
     -Wwrite-strings \
-    -Wzero-as-null-pointer-constant \
     ; do
     AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
   done
@@ -169,20 +168,29 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
   AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
   AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
 
-  # These are needed for older GCC versions.
+  # These depend on the GCC version.
   if test -n "$GCC" && gl_gcc_version=`($CC --version) 2>/dev/null`; then
     case $gl_gcc_version in
-      'gcc (GCC) '[[0-3]].* | \
-      'gcc (GCC) '4.[[0-7]].*)
+      gcc*' ('*') '[[0-3]].* | \
+      gcc*' ('*') '4.[[0-7]].*)
         AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
         AS_VAR_APPEND([$1], [' -funit-at-a-time'])
           ;;
     esac
     case $gl_gcc_version in
-      'gcc (GCC) '[[0-9]].*)
+      gcc*' ('*') '[[0-9]].*)
         AS_VAR_APPEND([$1], [' -fno-common'])
           ;;
     esac
+    case $gl_gcc_version in
+      gcc*' ('*') '?.* | gcc*' ('*') '1[[1-4]].*)
+          # In GCC < 15 the option either does not exist,
+          # or is accepted but always warns.
+          ;;
+      *)
+          AS_VAR_APPEND([$1], [' -Wzero-as-null-pointer-constant'])
+          ;;
+    esac
   fi
 
   # These options are not supported by gcc, but are useful with clang.