From: Paul Eggert Date: Mon, 4 May 2026 18:28:59 +0000 (-0700) Subject: Port AC_C_RESTRICT to GCC 16 -Wkeyword-macro X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1323c74512db617723ab754e79846f9ebb44ce8;p=thirdparty%2Fautoconf.git Port AC_C_RESTRICT to GCC 16 -Wkeyword-macro 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__). --- diff --git a/NEWS b/NEWS index efa21f9d3..f047edce9 100644 --- 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 cb5362286..a20386795 100644 --- 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 ? diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 4771b2c99..218c78a7d 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -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