bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] proposed patch to gettext.h for gcc -ansi -pedantic


From: Paul Eggert
Subject: Re: [bug-gnulib] proposed patch to gettext.h for gcc -ansi -pedantic
Date: Mon, 27 Nov 2006 12:38:27 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

>   - 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,

But this case is different.  Here, __STDC_VERSION__ is inspected only
if GCC 3 or later, so __STDC_VERSION__ >= 199901L should reliably
indicate whether variable size arrays are supported.

>   - Why would it be useful to use variable size arrays if
>     (__STDC_VERSION__ >= 199901L && __STRICT_ANSI__) ?

For efficiency when compiled by "gcc -std=c99".

>     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.

I just now checked that URL, and apparently it was documented properly
after all, just in a different place.  So, how about this patch?
Admittedly it's not a huge point, since gcc -std=c99 is fairly rare,
but it's nice to have this patch if only for accurate internal
documentation.

2006-11-27  Paul Eggert  <address@hidden>

        * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS):
        If GCC 3 or later, define if __STDC_VERSION__ >= 199901L,
        as GCC supports variable size arrays in this case even
        when __STRICT_ANSI__ is defined.

*** lib/gettext.h       27 Nov 2006 14:17:38 -0000      1.14
--- lib/gettext.h       27 Nov 2006 20:34:16 -0000
***************
*** 169,175 ****
  #include <string.h>
  
  #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
!   (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
     /* || __STDC_VERSION__ >= 199901L */ )
  
  #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
--- 169,176 ----
  #include <string.h>
  
  #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
!   (((__GNUC__ >= 3 || __GNUG__ >= 2) \
!     && (__STDC_VERSION__ >= 199901L || ! __STRICT_ANSI__)) \
     /* || __STDC_VERSION__ >= 199901L */ )
  
  #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS




reply via email to

[Prev in Thread] Current Thread [Next in Thread]