[CCing autoconf-patches] Paul Eggert wrote on 2026-05-04: > I installed the attached into both > Autoconf and Gnulib, and I hope it works around this somewhat messy > problem. Thanks for reporting it.
> 0001-Pacify-GCC-16-Wkeyword-macro-for-restrict.patch This patch causes compilation errors 1) with MSVC, 2) with g++ on Solaris 11.4. 1) For MSVC 14.44.35207, a.k.a. MSVC 2022 (on the GitHub CI machines), the first encountered error is: /cygdrive/d/a/ci-testdir-check/ci-testdir-check/compile cl -nologo -std:c11 -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -DNO_XMALLOC -DEXEEXT=\".exe\" -I. -I../../gllib -I.. -DGNULIB_STRICT_CHECKING=1 -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc64/include -DCONTINUE_AFTER_ASSERT -MD -c -o gc-gnulib.obj `cygpath -w '../../gllib/gc-gnulib.c'` gc-gnulib.c D:\a\ci-testdir-check\ci-testdir-check\testdir-all\gllib\rijndael-alg-fst.h(61): error C2143: syntax error: missing ']' before 'restrict' As noted in https://lists.gnu.org/archive/html/bug-gnulib/2026-05/msg00028.html, this compiler has __STDC_VERSION__ >= 199901L although it's not fully C99 compliant. Therefore the fix is to ignore __STDC_VERSION__ on MSVC. 2) For g++ on Solaris 11.4, version 7.3.0, find attached the output of "gmake -k" in a Gnulib testdir-all. The cause is that this g++ build is configured to define __STDC_VERSION__ to 199901L initially. (A g++ 7.x build on Linux does not do so.) Therefore the fix is to ignore __STDC_VERSION__ in C++ mode. C++ does not have the 'restrict' keyword. (Verified with g++ and clang++.) I'm applying this fix to Gnulib. Tested on MSVC and Solaris 11.4. Paul, can you please sync Autoconf master with that?
gmake-k.log.gz
Description: application/gzip
>From ac5b9174499be8ec0e140fad7f80828ffc55c819 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Sat, 9 May 2026 23:09:39 +0200 Subject: [PATCH] Fix 'restrict' on MSVC and on Solaris 11.4 g++ (regression 2026-05-04). * m4/gnulib-common.m4 (AC_C_RESTRICT): Ignore the value of __STDC_VERSION__ on MSVC or in C++ mode. --- ChangeLog | 6 ++++++ m4/gnulib-common.m4 | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24ce28b1a5..6617c81219 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2026-05-09 Bruno Haible <[email protected]> + + Fix 'restrict' on MSVC and on Solaris 11.4 g++ (regression 2026-05-04). + * m4/gnulib-common.m4 (AC_C_RESTRICT): Ignore the value of + __STDC_VERSION__ on MSVC or in C++ mode. + 2026-05-09 Bruno Haible <[email protected]> Document another quality assurance recipe. diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 26110f4ab7..12b0836e2a 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ # gnulib-common.m4 -# serial 121 +# serial 122 dnl Copyright (C) 2007-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, @@ -1279,9 +1279,12 @@ AC_DEFUN([AC_C_RESTRICT] ]) AH_VERBATIM([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 directly. */ -#if ! (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__) + nothing if this is not supported. In particular it is not supported + in MSVC 14.44 and in g++ 7 on Solaris 11, although these compilers + define __STDC_VERSION__ to 199901L. + Do not define if restrict is supported directly. */ +#if ! (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \ + && !defined _MSC_VER && !defined __cplusplus) #undef restrict #endif /* Work around a bug in older versions of Sun C++, which did not -- 2.54.0
