]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Port AC_C_RESTRICT to GCC 16 -Wkeyword-macro
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 May 2026 18:28:59 +0000 (11:28 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 May 2026 20:23:08 +0000 (13:23 -0700)
Problem reported by Collin Funk in:
https://lists.gnu.org/r/bug-gnulib/2026-05/msg00011.html
* lib/autoconf/c.m4 (AC_C_RESTRICT): Protect the "#undef restrict",
which may transmute into "#define restrict __restrict__",
with #if ! (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__).

NEWS
THANKS
lib/autoconf/c.m4

diff --git a/NEWS b/NEWS
index efa21f9d33d25759331b4e666421aae7c2c7df9f..f047edce958e3ce65b903b7a748f76bc033dc6fe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes.
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Notable bug fixes
+
+*** AC_C_RESTRICT no longer triggers -Wkeyword-macro warnings from GCC 16.
 
 * Noteworthy changes in release 2.73 (2026-03-20) [release]
 
diff --git a/THANKS b/THANKS
index cb5362286dbf1e1b380f92e2964edf0fbb9349c0..a2038679572e69cd0aea0e96a597af5f614ba2d7 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -89,6 +89,7 @@ Christopher Hulbert         cchgroupmail@gmail.com
 Christopher Lee             chrislee@ri.cmu.edu
 Clinton Roy                 clinton.roy@gmail.com
 Colin Watson                cjwatson@debian.org
+Collin Funk                 collin.funk1@gmail.com
 Corinna Vinschen            corinna-cygwin@cygwin.com
 Cort Dougan                 cort@cs.nmt.edu
 D'Arcy A MacIsaac           ?
index 4771b2c991e5ef78f9ed6116ffe54e92c9e7eec5..218c78a7d7ec0ece1dc4e1f48c974679e7d60116 100644 (file)
@@ -2172,10 +2172,10 @@ fi
 #
 # Determine whether the C/C++ compiler supports the "restrict" keyword
 # introduced in ANSI C99, or an equivalent.  Define "restrict" to the alternate
-# spelling, if any; these are more likely to work in both C and C++ compilers of
+# spelling, if any, in pre-C99 C and in C++; this should work in compilers of
 # the same family, and in the presence of varying compiler options.  If only
 # plain "restrict" works, do nothing.  Here are some variants:
-# - GCC supports both __restrict and __restrict__
+# - GCC-compatible compilers support both __restrict and __restrict__
 # - older DEC Alpha C compilers support only __restrict
 # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
 # Otherwise, define "restrict" to be empty.
@@ -2207,7 +2207,9 @@ AC_DEFUN([AC_C_RESTRICT],
 [/* Define to the equivalent of the C99 'restrict' keyword, or to
    nothing if this is not supported.  Do not define if restrict is
    supported only directly.  */
+#if ! (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__)
 #undef restrict
+#endif
 /* Work around a bug in older versions of Sun C++, which did not
    #define __restrict__ or support _Restrict or __restrict__
    even though the corresponding Sun C compiler ended up with