I tried compiling coreutils with gcc -ansi -pedantic (ah, the good old days!) and found some incompatibilities had crept into the regex module. I installed this to fix them:
2006-11-26 Paul Eggert <[EMAIL PROTECTED]> 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. Index: lib/regex.h =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regex.h,v retrieving revision 1.38 diff -u -r1.38 regex.h --- lib/regex.h 10 Aug 2006 20:08:01 -0000 1.38 +++ lib/regex.h 27 Nov 2006 07:15:02 -0000 @@ -635,14 +635,17 @@ # 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. */ Index: lib/regex_internal.h =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regex_internal.h,v retrieving revision 1.24 diff -u -r1.24 regex_internal.h --- lib/regex_internal.h 21 Aug 2006 06:11:26 -0000 1.24 +++ lib/regex_internal.h 27 Nov 2006 07:15:02 -0000 @@ -348,7 +348,7 @@ 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; Index: lib/regexec.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regexec.c,v retrieving revision 1.22 diff -u -r1.22 regexec.c --- lib/regexec.c 5 Jun 2006 05:21:20 -0000 1.22 +++ lib/regexec.c 27 Nov 2006 07:15:02 -0000 @@ -3966,7 +3966,7 @@ # 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'};