This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: duplicate FILE typedef, stdio.h and wchar.h


On Mar  4 11:35, Craig Howland wrote:
> 
> On 03/04/2015 05:07 AM, Corinna Vinschen wrote:
> >Hi Craig,
> >
> >On Mar  3 23:05, Craig Howland wrote:
> >>      stdio.h and wchar.h both have unconditional "typedef FILE __FILE"
> >>declarations, which causes GCC to error out if both are included to the same
> >>source, which happens in any number of newlib source files.  (For example,
> >>libc/stdlib/btowc.c.)
> >I'm rather puzzled by this observation.  As you may imagine, these files
> >are used for a long time in packages in the Cygwin distro, and if GCC
> >would error out in this simple case, we had a lot of complaints from
> >Cygwin package maintainers.  So the first question is, in which scenario
> >do you see this problem?  I created an STC:
> >
> >--8<---------------cut here---------------start------------->8---
> >#include <wchar.h>
> >#include <stdio.h>
> >
> >extern FILE *foo (FILE *);
> >
> >int main ()
> >{
> >   FILE *fp = foo (NULL);
> >   if (fp)
> >     foo (fp);
> >   return 0;
> >}
> >--8<---------------cut here---------------end--------------->8---
> >
> >and gcc -c -g -O2 -Wall does not error out, nor does it even produce
> >a warning.  Same when reordering the includes.  Not even with -ansi.
> I was quite surprised, too, but it's doing it (gcc 4.4.7 under RHEL6).  I
> fiddled with options a little to no avail, but decided it was easier to just
> fix it.

Does the above testcase fail the same way with this gcc?  If not,
it might be some different problem.  I wouldn't want to apply a
fix which just covers another problem, if possible.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgpf6b3XxBrAx.pgp
Description: PGP signature


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