diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-07-31 18:10:31 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-07-31 18:10:31 +0000 |
commit | 111458f1bf05cbfe487bdab956917a59c5fdc60d (patch) | |
tree | 71356bf58f3c89b7f453bb3fe8fa75cffb958203 /gcc/c-decl.c | |
parent | cdbca1727ce8d428964efcb2f20ee82142a2c762 (diff) | |
download | gcc-111458f1bf05cbfe487bdab956917a59c5fdc60d.zip gcc-111458f1bf05cbfe487bdab956917a59c5fdc60d.tar.gz gcc-111458f1bf05cbfe487bdab956917a59c5fdc60d.tar.bz2 |
c-decl.c (mesg_implicit_function_declaration): Init to -1.
* c-decl.c (mesg_implicit_function_declaration): Init to -1.
(implicit_decl_warning): New function.
(implicitly_declare): Use it.
* c-typeck.c (build_external_ref): Use implicit_decl_warning
to complain about implicit decls of builtins.
* c-lang.c (lang_init): Set mesg_implicit_function_declaration
based on pedantic && flag_isoc99, if not already set.
* c-tree.h: Declare mesg_implicit_function_declaration.
Prototype implicit_decl_warning.
* gcc.dg/c99-impl-decl-1.c: No longer XFAIL.
From-SVN: r35385
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 34a8f42..a9eb619 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -358,7 +358,7 @@ int warn_long_long = 1; /* Nonzero means message about use of implicit function declarations; 1 means warning; 2 means error. */ -int mesg_implicit_function_declaration; +int mesg_implicit_function_declaration = -1; /* Nonzero means give string constants the type `const char *' to get extra warnings from them. These warnings will be too numerous @@ -2525,15 +2525,8 @@ implicitly_declare (functionid) rest_of_decl_compilation (decl, NULL_PTR, 0, 0); - if (mesg_implicit_function_declaration && implicit_warning) - { - if (mesg_implicit_function_declaration == 2) - error ("implicit declaration of function `%s'", - IDENTIFIER_POINTER (functionid)); - else - warning ("implicit declaration of function `%s'", - IDENTIFIER_POINTER (functionid)); - } + if (implicit_warning) + implicit_decl_warning (functionid); else if (warn_traditional && traditional_warning) warning ("function `%s' was previously declared within a block", IDENTIFIER_POINTER (functionid)); @@ -2546,6 +2539,17 @@ implicitly_declare (functionid) return decl; } +void +implicit_decl_warning (id) + tree id; +{ + char *name = IDENTIFIER_POINTER (id); + if (mesg_implicit_function_declaration == 2) + error ("implicit declaration of function `%s'", name); + else if (mesg_implicit_function_declaration == 1) + warning ("implicit declaration of function `%s'", name); +} + /* Return zero if the declaration NEWDECL is valid when the declaration OLDDECL (assumed to be for the same name) has already been seen. |