This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: stdio.h: broken standard compliance.
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 10 Oct 2011 11:21:12 +0200
- Subject: Re: stdio.h: broken standard compliance.
- References: <011d066ef0c80ba22bccc432fbc1b5fc@127.0.0.1> <be85065e5a355059f429f59dfec6271c@127.0.0.1>
- Reply-to: cygwin at cygwin dot com
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