This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [Michal Moskal <malekith@pld.org.pl>] libc/1931: gconv.h uses array of size [0], ANSI C complier cannot compile hello.c
- To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Subject: Re: [Michal Moskal <malekith@pld.org.pl>] libc/1931: gconv.h uses array of size [0], ANSI C complier cannot compile hello.c
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 27 Nov 2000 09:34:02 -0800
- Cc: Andreas Jaeger <aj at suse dot de>, libc-alpha at sources dot redhat dot com, Michal Moskal <malekith at pld dot org dot pl>
- References: <Pine.SOL.4.21.0011271128200.18178-100000@yellow.csi.cam.ac.uk>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
"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 `------------------------