Paul Eggert wrote: > gettext.h also has a problem with gcc -ansi -pedantic: it uses the > [restrict] syntax in that case, but GCC complains about it since > [restrict] isn't in C89. Here's a proposed patch: > > 2006-11-26 Paul Eggert <[EMAIL PROTECTED]> > > * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): > Don't define if __STRICT_ANSI__, unless it's C99 or later, > since C89 lacked support for the [restrict] syntax and > gcc -ansi -pedantic complains about it. > > Index: lib/gettext.h > =================================================================== > RCS file: /cvsroot/gnulib/gnulib/lib/gettext.h,v > retrieving revision 1.13 > diff -p -u -r1.13 gettext.h > --- lib/gettext.h 10 Nov 2006 14:49:09 -0000 1.13 > +++ lib/gettext.h 27 Nov 2006 07:17:01 -0000 > @@ -169,7 +169,9 @@ npgettext_aux (const char *domain, > #include <string.h> > > #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ > - (__GNUC__ >= 3 || __GNUG__ >= 2 /* || __STDC_VERSION__ >= 199901L */ ) > + (((__GNUC__ >= 3 || __GNUG__ >= 2) \ > + && (__STDC_VERSION__ >= 199901L || ! __STRICT_ANSI__)) \ > + /* || __STDC_VERSION__ >= 199901L */) > > #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS > #include <stdlib.h>
Thanks. I prefer this patch, because - I don't want to rely on __STDC_VERSION__ for the reasons explained in http://lists.gnu.org/archive/html/bug-gnulib/2006-10/msg00354.html, - Why would it be useful to use variable size arrays if (__STDC_VERSION__ >= 199901L && __STRICT_ANSI__) ? The gcc manual documents that __STRICT_ANSI__ stands for strict ISO C90; this looks like a gcc bug to me: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29994 Until they document it properly, I prefer to ignore this case. Bruno 2006-11-27 Paul Eggert <[EMAIL PROTECTED]> Bruno Haible <[EMAIL PROTECTED]> * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Define to 0 if compiling with "gcc -ansi". *** gettext.h 10 Nov 2006 14:50:17 -0000 1.6 --- gettext.h 27 Nov 2006 13:53:12 -0000 1.7 *************** *** 170,176 **** #include <string.h> #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ ! (__GNUC__ >= 3 || __GNUG__ >= 2 /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include <stdlib.h> --- 170,177 ---- #include <string.h> #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ ! (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ ! /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include <stdlib.h>