This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: C99 implies -Wimplicit-function-declaration?
- From: "Gary Funck" <gary at intrepid dot com>
- To: "Gcc Mailing List" <gcc at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 20 May 2005 19:45:48 -0700
- Subject: RE: C99 implies -Wimplicit-function-declaration?
Joseph S. Myers wrote (in part):
> No prototype is different from no declaration at all. Implicit function
> declarations are not part of C99, so the code is in error in C99 mode.
OK, thanks. I (now) understand that the reference to a warning about a missing protoype
does not apply. However, I don't see anything in section 6.5.2.2
(rev. 1999-12-01) that says that a function declaration or prototype
declaration must (or should) precede a call to the function. And GCC isn't treating it
as an error, but rather is enabling the warning by default.
The code reads as follows (in c-objc-common.c):
/* If still unspecified, make it match -std=c99
(allowing for -pedantic-errors). */
if (mesg_implicit_function_declaration < 0)
{
if (flag_isoc99)
mesg_implicit_function_declaration = flag_pedantic_errors ? 2 : 1;
else
mesg_implicit_function_declaration = 0;
}
And mesg_implicit_function_declaration is initialized to -1 (c-common.c):
/* Nonzero means message about use of implicit function declarations;
1 means warning; 2 means error. */
int mesg_implicit_function_declaration = -1;