From: Bruno Haible Date: Wed, 6 May 2026 08:50:49 +0000 (+0200) Subject: regex: Fix compilation error with MSVC 2022. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cbc34fcd33a6c63afa24ac2345f575f38e750d7;p=thirdparty%2Fgnulib.git regex: Fix compilation error with MSVC 2022. * lib/cdefs.h (__restrict_arr): On MSVC, ignore __STDC_VERSION__. * lib/regex.h (_Restrict_arr_): Likewise. --- diff --git a/ChangeLog b/ChangeLog index a29f290ea8..0bdf9d3745 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2026-05-06 Bruno Haible + + regex: Fix compilation error with MSVC 2022. + * lib/cdefs.h (__restrict_arr): On MSVC, ignore __STDC_VERSION__. + * lib/regex.h (_Restrict_arr_): Likewise. + 2026-05-06 Bruno Haible localeinfo: now LGPLv2+ diff --git a/lib/cdefs.h b/lib/cdefs.h index 42024b20e1..2800057cb7 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -669,7 +669,8 @@ # ifdef __GNUC__ # define __restrict_arr /* Not supported in old GCC. */ # else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L \ + && !defined _MSC_VER) # define __restrict_arr restrict # else /* Some other non-C99 compiler. */ diff --git a/lib/regex.h b/lib/regex.h index df35c93e5a..152a157c2f 100644 --- a/lib/regex.h +++ b/lib/regex.h @@ -645,15 +645,15 @@ extern int re_exec (const char *); array_name[restrict] use glibc's __restrict_arr if available. Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode). - Other ISO C99 compilers support it as well. */ + Other ISO C99 compilers support it as well, except for MSVC. */ #ifndef _Restrict_arr_ # ifdef __restrict_arr # define _Restrict_arr_ __restrict_arr # else -# if ((199901L <= __STDC_VERSION__ \ - || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ - || __clang_major__ >= 3) \ - && !defined __cplusplus) +# if (((199901L <= __STDC_VERSION__ && !defined _MSC_VER) \ + || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3) \ + && !defined __cplusplus) # define _Restrict_arr_ _Restrict_ # else # define _Restrict_arr_