]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
regex: Fix compilation error with MSVC 2022.
authorBruno Haible <bruno@clisp.org>
Wed, 6 May 2026 08:50:49 +0000 (10:50 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 6 May 2026 08:50:49 +0000 (10:50 +0200)
* lib/cdefs.h (__restrict_arr): On MSVC, ignore __STDC_VERSION__.
* lib/regex.h (_Restrict_arr_): Likewise.

ChangeLog
lib/cdefs.h
lib/regex.h

index a29f290ea867032785033c11a14f0285654d409d..0bdf9d37451e04a29d49297d42c80caa453b423b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-05-06  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        localeinfo: now LGPLv2+
index 42024b20e111adafa801162f730e6e66c18e1c5a..2800057cb7d2789bbd87235d8823fd862dabe35f 100644 (file)
 # 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.  */
index df35c93e5aef8da7a18c3cfbd78cba9526c911b7..152a157c2f799f1bc3af21faf2e3b1225ff4c442 100644 (file)
@@ -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_