From: Paul Eggert Date: Fri, 16 Jan 2026 20:26:22 +0000 (-0800) Subject: manywarnings: omit new C warning for GCC < 15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73e6357e410c70a12ebedac4fc9d48f97e2c0ad4;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index bd77658a74..c880440831 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2026-01-16 Paul Eggert + 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 diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 97567b2530..4cb17a689a 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -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.