This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Michal Moskal <malekith@pld.org.pl>] libc/1931: gconv.h uses array of size [0], ANSI C complier cannot compile hello.c


"Joseph S. Myers" <jsm28@cam.ac.uk> writes:

> Wouldn't it be better to do something like the following in <sys/cdefs.h>
> (even if only gconv.h needs it at present), to properly support non-GCC
> C99 compilers?
> 
> #if __GNUC_PREREQ (3, 0)
> /* GCC 3.0 supports C99 flexible array members.  */
> #define __flexarr	[]
> #elif defined(__GNUC__)
> #define __flexarr	[0]
> #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
> #define __flexarr	[]
> #else
> /* Some other non-C99 compiler.  Approximate with [1].  */
> #define __flexarr	[1]
> #endif

Yes.  Except that we should use __GNUC_PREREQ(2,97) and use #else
instead of #elif.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]