aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>1995-03-05 23:27:16 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>1995-03-05 23:27:16 +0000
commitb3c8b55934b5a374218fecafb188ae9217fce41a (patch)
treef8ab8fe56759beb96fb46ddfc829f1238aed9d40 /gcc/c-decl.c
parentc32ee516f6e0ed401ced407d4a1aa36a1b491521 (diff)
Undo this patch, breaks libobjc builds.
* c-decl.c (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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9123 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 86c1024677d..0b3bb17554b 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, 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))
+ /* 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)
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))
- && lookup_name_current_level (DECL_NAME (newdecl)) == olddecl)
+ && DECL_CONTEXT (newdecl) == DECL_CONTEXT (olddecl))
return "redeclaration of `%s'";
return 0;
}