diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1995-02-24 18:21:37 -0800 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1995-02-24 18:21:37 -0800 |
commit | 4d53757da9f918b6f5a7c5d44e8810c3444d64b0 (patch) | |
tree | 705ba92845fcbdc0b457a584c6d0a53cb3b35aee | |
parent | 9791111f79a3ef3b1d64f5f2305428eb368b4ccd (diff) | |
download | gcc-4d53757da9f918b6f5a7c5d44e8810c3444d64b0.zip gcc-4d53757da9f918b6f5a7c5d44e8810c3444d64b0.tar.gz gcc-4d53757da9f918b6f5a7c5d44e8810c3444d64b0.tar.bz2 |
(pushdecl): When have a duplicate decl, and it is global,
delete lookup_name name in test for return.
(redeclaration_error_message): When newdecl is a block level
declaration, use lookup_name_current_level instead of DECL_CONTEXT.
From-SVN: r9072
-rw-r--r-- | gcc/c-decl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e4316ce..aa0fbe5 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1939,11 +1939,11 @@ pushdecl (x) IDENTIFIER_POINTER (name)); } - /* If this is a global decl, and there exists a conflicting local - decl in a parent block, then we can't return as yet, because we - need to register this decl in the current binding block. */ - if (! DECL_EXTERNAL (x) || ! TREE_PUBLIC (x) - || lookup_name (name) == t) + /* If this is a global decl, then we can't return as yet, because we + need to register this decl in the current binding block. This + ensures that we get an error message if it is redeclared as a + local variable later in the same block. */ + if (! DECL_EXTERNAL (x) || ! TREE_PUBLIC (x)) return t; } @@ -2422,7 +2422,7 @@ redeclaration_error_message (newdecl, olddecl) external reference. Otherwise, it is OK, because newdecl must be an extern reference to olddecl. */ if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl)) - && DECL_CONTEXT (newdecl) == DECL_CONTEXT (olddecl)) + && lookup_name_current_level (DECL_NAME (newdecl)) == olddecl) return "redeclaration of `%s'"; return 0; } |