X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=I0jFHxriRJwyplOnjK2nOSNCO7GacXBAI5CCNqI8fuI= c=1 sm=1 a=W5crty74aesA:10 a=Bqtapk49eCgA:10 a=SV9grZ613K4A:10 a=BLceEmwcHowA:10 a=i7s4YuWtaOcA:10 a=IkcTkHD0fZMA:10 a=IaHBZPgZ0vV7m0nTkA8unw==:17 a=2KUf1mbJAAAA:8 a=vt4-FNnFXFX0bfqKlNMA:9 a=QEXdDO2ut3YA:10 a=NsFnkn2YGo8A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 To: Subject: Re: stdio.h: broken standard compliance. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Date: Sun, 09 Oct 2011 11:23:07 -0700 From: Kaz Kylheku In-Reply-To: <011d066ef0c80ba22bccc432fbc1b5fc@127.0.0.1> References: <011d066ef0c80ba22bccc432fbc1b5fc AT 127 DOT 0 DOT 0 DOT 1> Message-ID: X-Sender: kaz AT kylheku DOT com User-Agent: Roundcube Webmail/0.4 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 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 posix-ansi.c: In function 'foo': posix-ansi.c:5:23: error: 'fileno' undeclared (first use in this function) posix-ansi.c:5:23: note: each undeclared identifier is reported only once for ea ch function it appears in posix-ansi.c:6:23: error: 'pclose' undeclared (first use in this function) posix-ansi.c:6:9: warning: unused variable 'f2' posix-ansi.c:5:9: warning: unused variable 'f1' posix-ansi.c: In function 'main': posix-ansi.c:11:3: warning: implicit declaration of function 'fileno' posix-ansi.c:12:3: warning: implicit declaration of function 'pclose' posix-ansi.c:11:7: warning: unused variable 'x' -- 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