[Michal Moskal <malekith@pld.org.pl>] libc/1931: gconv.h uses array of size [0], ANSI C complier cannot compile hello.c
Ulrich Drepper
drepper@redhat.com
Mon Nov 27 09:34:00 GMT 2000
"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 `------------------------
More information about the Libc-alpha
mailing list