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 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 > 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 > > 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