| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| Date: | Mon, 10 Oct 2011 11:21:12 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: stdio.h: broken standard compliance. |
| Message-ID: | <20111010092112.GA28134@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <011d066ef0c80ba22bccc432fbc1b5fc AT 127 DOT 0 DOT 0 DOT 1> <be85065e5a355059f429f59dfec6271c AT 127 DOT 0 DOT 0 DOT 1> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <be85065e5a355059f429f59dfec6271c@127.0.0.1> |
| User-Agent: | Mutt/1.5.21 (2010-09-15) |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list 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 AT kylheku DOT 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |