aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1994-07-21 21:55:22 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1994-07-21 21:55:22 +0000
commit98f6402e3a53ce1034c29b3dfe821afc45d84735 (patch)
tree437d6f5e728cb8f2673248f9924ed96896ac244c /gcc/c-decl.c
parentd3d5ed2a204f1709c59a01250cfcd3273b08eebc (diff)
(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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@7787 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index c1a8dc99393..3c0dea04bad 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");