stdio.h: broken standard compliance.

Kaz Kylheku
Sun Oct 9 18:23:00 GMT 2011

On Sun, 09 Oct 2011 11:08:58 -0700, Kaz Kylheku <>
> 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

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);
  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
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
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:
Unsubscribe info:

More information about the Cygwin mailing list