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 usesarray of size [0], ANSI C complier cannot compile hello.c
- To: Andreas Jaeger <aj at suse dot de>
- Subject: Re: [Michal Moskal <malekith@pld.org.pl>] libc/1931: gconv.h usesarray of size [0], ANSI C complier cannot compile hello.c
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Mon, 27 Nov 2000 11:34:10 +0000 (GMT)
- cc: libc-alpha at sources dot redhat dot com, Michal Moskal <malekith at pld dot org dot pl>
On 27 Nov 2000, Andreas Jaeger wrote:
> ============================================================
> Index: iconv/gconv.h
> --- iconv/gconv.h 2000/11/20 08:49:09 1.26
> +++ iconv/gconv.h 2000/11/27 10:34:02
> @@ -168,7 +168,11 @@
> {
> size_t __nsteps;
> struct __gconv_step *__steps;
> +# ifdef __GNUC__
> __extension__ struct __gconv_step_data __data[0];
> +# else
> + struct __gconv_step_data *__data [1];
> +# endif
> } *__gconv_t;
>
> #endif /* gconv.h */
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
--
Joseph S. Myers
jsm28@cam.ac.uk