Fix some incompatibilities with gcc -ansi -pedantic.
[gnulib.git] / lib / regex.h
index e8748e1..621bffb 100644 (file)
@@ -635,14 +635,17 @@ extern int re_exec (const char *);
 #  endif
 # endif
 #endif
-/* gcc 3.1 and up support the [restrict] syntax.  */
-#ifndef __restrict_arr
-# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
-     && !defined __GNUG__
-#  define __restrict_arr __restrict
-# else
-#  define __restrict_arr
-# endif
+/* gcc 3.1 and up support the [restrict] syntax.  Don't trust
+   sys/cdefs.h's definition of __restrict_arr, though, as it
+   mishandles gcc -ansi -pedantic.  */
+#undef __restrict_arr
+#if (defined __GNUG__                          \
+     || (__STDC_VERSION__ < 199901L            \
+        && (__STRICT_ANSI__                    \
+            || (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)))))
+# define __restrict_arr
+#else
+# define __restrict_arr __restrict
 #endif
 
 /* POSIX compatibility.  */