public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37771] New: warning: implicit declaration of function 'fileno'
@ 2008-10-08 12:23 mathieu dot malaterre at gmail dot com
2008-10-08 12:49 ` [Bug c/37771] " paolo dot carlini at oracle dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mathieu dot malaterre at gmail dot com @ 2008-10-08 12:23 UTC (permalink / raw)
To: gcc-bugs
The following piece of code should compile without warning:
#include <stdio.h>
int main()
{
(void)fileno(0);
return 0;
}
Using:
$ gcc -Wall -W -pedantic -ansi -Werror f.c
cc1: warnings being treated as errors
f.c: In function 'main':
f.c:5: warning: implicit declaration of function 'fileno'
With:
$ gcc --version
gcc (GCC) 4.2.3 (Debian 4.2.3-3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
thanks
--
Summary: warning: implicit declaration of function 'fileno'
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mathieu dot malaterre at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37771
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/37771] warning: implicit declaration of function 'fileno'
2008-10-08 12:23 [Bug c/37771] New: warning: implicit declaration of function 'fileno' mathieu dot malaterre at gmail dot com
@ 2008-10-08 12:49 ` paolo dot carlini at oracle dot com
2008-10-08 12:53 ` mathieu dot malaterre at gmail dot com
2008-10-08 12:57 ` paolo dot carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-10-08 12:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2008-10-08 12:48 -------
The warning is correct: by default, fileno, not being a standard C function, is
simply not declared in the <stdio.h> header of your linux machine. A quick look
to the man page reveals that the function is declared when, e.g., _POSIX_SOURCE
is defined.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Summary| warning: implicit |warning: implicit
|declaration of function |declaration of function
|'fileno' |'fileno'
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37771
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/37771] warning: implicit declaration of function 'fileno'
2008-10-08 12:23 [Bug c/37771] New: warning: implicit declaration of function 'fileno' mathieu dot malaterre at gmail dot com
2008-10-08 12:49 ` [Bug c/37771] " paolo dot carlini at oracle dot com
@ 2008-10-08 12:53 ` mathieu dot malaterre at gmail dot com
2008-10-08 12:57 ` paolo dot carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: mathieu dot malaterre at gmail dot com @ 2008-10-08 12:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mathieu dot malaterre at gmail dot com 2008-10-08 12:52 -------
Hum... ok nevermind. My man page must be outdated.
ref:
FERROR(3) Linux Programmer's Manual FERROR(3)
NAME
clearerr, feof, ferror, fileno - check and reset stream status
SYNOPSIS
#include <stdio.h>
void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
int fileno(FILE *stream);
DESCRIPTION
The function clearerr() clears the end-of-file and error indicators for
the stream pointed to by stream.
The function feof() tests the end-of-file indicator for the stream
pointed to by stream, returning non-zero if it is set. The end-of-file
indicator can only be cleared by the function clearerr().
The function ferror() tests the error indicator for the stream pointed
to by stream, returning non-zero if it is set. The error indicator can
only be reset by the clearerr() function.
The function fileno() examines the argument stream and returns its
integer descriptor.
For non-locking counterparts, see unlocked_stdio(3).
ERRORS
These functions should not fail and do not set the external variable
errno. (However, in case fileno() detects that its argument is not a
valid stream, it must return -1 and set errno to EBADF.)
CONFORMING TO
The functions clearerr(), feof(), and ferror() conform to C89.
SEE ALSO
open(2), fdopen(3), stdio(3), unlocked_stdio(3)
2001-10-16 FERROR(3)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37771
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/37771] warning: implicit declaration of function 'fileno'
2008-10-08 12:23 [Bug c/37771] New: warning: implicit declaration of function 'fileno' mathieu dot malaterre at gmail dot com
2008-10-08 12:49 ` [Bug c/37771] " paolo dot carlini at oracle dot com
2008-10-08 12:53 ` mathieu dot malaterre at gmail dot com
@ 2008-10-08 12:57 ` paolo dot carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-10-08 12:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo dot carlini at oracle dot com 2008-10-08 12:56 -------
Note, anyway, that fileno is not present in CONFORMING TO as a C89 function.
Which indeed it is not. In any case, the ultimate reference is the C Standard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37771
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-08 12:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-08 12:23 [Bug c/37771] New: warning: implicit declaration of function 'fileno' mathieu dot malaterre at gmail dot com
2008-10-08 12:49 ` [Bug c/37771] " paolo dot carlini at oracle dot com
2008-10-08 12:53 ` mathieu dot malaterre at gmail dot com
2008-10-08 12:57 ` paolo dot carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).