Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Bruno Haible
Thank you for all contributions to this thread. Yes, mbstate_t is a struct on: Cygwin, FreeBSD, glibc, Haiku, HP-UX, Interix, OSF/1, Solaris a union on: MacOS X, NetBSD, OpenBSD scalar on:AIX, IRIX, mingw missing on: BeOS, HP-UX 11.00 So a portable initializer is {0} (not {0,} - that is

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Micah Cowan
Ben Pfaff wrote: > Eric Blake writes: > >> Jim Meyering meyering.net> writes: >>> -mbstate_t _gl_mbsrtowcs_state = 0; >>> +mbstate_t _gl_mbsrtowcs_state = { 0, }; >> Is this correct for all platforms? If I read Posix correctly, mbstate_t can >> be >> a numeric type rather than a struct. > >

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Ben Pfaff
Eric Blake writes: > Jim Meyering meyering.net> writes: >> -mbstate_t _gl_mbsrtowcs_state = 0; >> +mbstate_t _gl_mbsrtowcs_state = { 0, }; > > Is this correct for all platforms? If I read Posix correctly, mbstate_t can > be > a numeric type rather than a struct. The initializer for an object

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Jim Meyering
Jim Meyering wrote: > Eric Blake wrote: >> Jim Meyering meyering.net> writes: >>> @@ -20,4 +20,4 @@ >>> #include >>> >>> /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ >>> -mbstate_t _gl_mbsrtowcs_state = 0; >>> +mbstate_t _gl_mbsrtowcs_state = { 0, }; >> >> Is this c

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Jim Meyering
Eric Blake wrote: > Pádraig Brady draigBrady.com> writes: > >> The {0,} init method works for scalar or aggregate types: >> http://www.pixelbeat.org/programming/gcc/auto_init.html >> Though as noted there, may give warnings. > > But the whole point of this patch is to silence warnings. What good

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Eric Blake
Pádraig Brady draigBrady.com> writes: > The {0,} init method works for scalar or aggregate types: > http://www.pixelbeat.org/programming/gcc/auto_init.html > Though as noted there, may give warnings. But the whole point of this patch is to silence warnings. What good is trading one warning for

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Eric Blake
Jim Meyering meyering.net> writes: > See his earlier commit: > > 2009-01-25 Bruno Haible clisp.org> > > Avoid link errors on MacOS X 10.3. > * lib/mbsrtowcs-state.c (_gl_mbsrtowcs_state): Add initializer. > * lib/wcsrtombs-state.c (_gl_wcsrtombs_state): Likewise. The

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Pádraig Brady
Jim Meyering wrote: > Eric Blake wrote: > >> Jim Meyering meyering.net> writes: >> >>> @@ -20,4 +20,4 @@ >>> #include >>> >>> /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ >>> -mbstate_t _gl_mbsrtowcs_state = 0; >>> +mbstate_t _gl_mbsrtowcs_state = { 0, }; >> Is thi

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> @@ -20,4 +20,4 @@ >> #include >> >> /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ >> -mbstate_t _gl_mbsrtowcs_state = 0; >> +mbstate_t _gl_mbsrtowcs_state = { 0, }; > > Is this correct for all platforms? I

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Eric Blake
Jim Meyering meyering.net> writes: > @@ -20,4 +20,4 @@ > #include > > /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ > -mbstate_t _gl_mbsrtowcs_state = 0; > +mbstate_t _gl_mbsrtowcs_state = { 0, }; Is this correct for all platforms? If I read Posix correctly, mbst

[PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure

2009-04-28 Thread Jim Meyering
ate: Tue, 28 Apr 2009 15:27:58 +0200 Subject: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure * lib/mbsrtowcs-state.c (_gl_mbsrtowcs_state): Initialize a variable of type mbstate_t using {0,}, not 0. This is required with some versions of gcc (at least 4.2.3). * lib/wcsrto