Mercurial > hg > octave-nkf > gnulib-hg
changeset 7689:b4806b1ec9e4
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 27 Nov 2006 07:15:26 +0000 |
parents | abc20b5ad112 |
children | a9847370afd4 |
files | ChangeLog lib/regex.h lib/regex_internal.h lib/regexec.c |
diffstat | 4 files changed, 25 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +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.
--- a/lib/regex.h +++ b/lib/regex.h @@ -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. */
--- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -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;
--- a/lib/regexec.c +++ b/lib/regexec.c @@ -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'};