stdio.h: broken standard compliance.
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Oct 10 09:21:00 GMT 2011
On Oct 9 11:23, Kaz Kylheku wrote:
>
> On Sun, 09 Oct 2011 11:08:58 -0700, Kaz Kylheku <kaz@kylheku.com>
> wrote:
> > reason, I cannot get a warning about fileno from this test case if
> > I add a reference to it. I will try to produce a minimal repro test
> > case for that.
>
> In my real program I have -Wall, and I'm not taking the function
> pointers.
>
> With -Wall we get warnings about implicit declarations.
>
> So, here is a better test case which shows that these identifiers are
> not declared when they should be. Of course the two errors occur
> without -Wall.
>
> $ cat posix-ansi.c
> #include <stdio.h>
>
> void foo(void)
> {
> int (*f1)(FILE *) = fileno;
> int (*f2)(FILE *) = pclose;
> }
>
> int main(void)
> {
> int x = fileno(stdin);
> pclose(NULL);
> return 0;
> }
>
> $ gcc -Wall -ansi -D_POSIX_C_SOURCE=2 posix-ansi.c
^^^^^
fileno and pclose are *not* ANSI functions. Therefore, if you define
-ansi, you get the below errors. The newlib headers have explicit
#ifndef __STRICT_ANSI__ guards around the non-ANSI definitions.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list