diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1994-07-21 14:55:22 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1994-07-21 14:55:22 -0700 |
commit | 6fc7c517d571f4c666b9b1a8764759ea4a2d3496 (patch) | |
tree | 437d6f5e728cb8f2673248f9924ed96896ac244c | |
parent | 59d9021293ae8e85286df22390eb5e154f6ae207 (diff) | |
download | gcc-6fc7c517d571f4c666b9b1a8764759ea4a2d3496.zip gcc-6fc7c517d571f4c666b9b1a8764759ea4a2d3496.tar.gz gcc-6fc7c517d571f4c666b9b1a8764759ea4a2d3496.tar.bz2 |
(start_function): If old_decl is NULL, then set it to the implicit decl if any.
(start_function): If old_decl is NULL, then set it to
the implicit decl if any. Delete superfluous test from warn missing
prototypes code. For warn missing declarations code, only warn if
previous decl is implicit.
From-SVN: r7787
-rw-r--r-- | gcc/c-decl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c1a8dc9..3c0dea0 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5922,6 +5922,11 @@ start_function (declspecs, declarator, nested) current_function_prototype_line = DECL_SOURCE_LINE (old_decl); } + /* If there is no explicit declaration, look for any out-of-scope implicit + declarations. */ + if (old_decl == 0) + old_decl = IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)); + /* Optionally warn of old-fashioned def with no previous prototype. */ if (warn_strict_prototypes && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0 @@ -5937,7 +5942,7 @@ start_function (declspecs, declarator, nested) if the function has already been used. */ else if (warn_missing_prototypes && old_decl != 0 && TREE_USED (old_decl) - && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0)) + && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0) warning_with_decl (decl1, "`%s' was used with no prototype before its definition"); /* Optionally warn of any global def with no previous declaration. */ @@ -5949,7 +5954,8 @@ start_function (declspecs, declarator, nested) /* Optionally warn of any def with no previous declaration if the function has already been used. */ else if (warn_missing_declarations - && old_decl != 0 && TREE_USED (old_decl)) + && old_decl != 0 && TREE_USED (old_decl) + && old_decl == IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1))) warning_with_decl (decl1, "`%s' was used with no declaration before its definition"); |