+2006-11-26 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix some incompatibilities with gcc -ansi -pedantic.
+ * lib/regex.h (__restrict_arr): Don't use the [restrict] syntax
+ if compiling pedantically with GCC, unless it's C99 or later.
+ Don't trust sys/cdefs.h's definition of __restrict_arr, either, as
+ it mishandles gcc -ansi -pedantic as well.
+ * lib/regex_internal.h (re_token_t): Don't use enum bitfields
+ if gcc -pedantic.
+ * lib/regexec.c (check_node_accept_bytes): Don't use auto
+ initializers for struct if -pedantic, unless it's C99 or later.
+
2006-11-25 Nix <nix@esperi.org.uk> (tiny change)
* m4/fcntl_h.m4 (gl_FCNTL_H): Test the atime, not the mtime.
# 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. */
Idx idx; /* for BACK_REF */
re_context_type ctx_type; /* for ANCHOR */
} opr;
-#if __GNUC__ >= 2
+#if __GNUC__ >= 2 && !__STRICT_ANSI__
re_token_type_t type : 8;
#else
re_token_type_t type;
# endif /* _LIBC */
{
/* match with range expression? */
-#if __GNUC__ >= 2
+#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && __STRICT_ANSI__)
wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'};
#else
wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'};