Commit 4d53757d by Jim Wilson

(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
parent 9791111f
...@@ -1939,11 +1939,11 @@ pushdecl (x) ...@@ -1939,11 +1939,11 @@ pushdecl (x)
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
} }
/* If this is a global decl, and there exists a conflicting local /* If this is a global decl, then we can't return as yet, because we
decl in a parent block, then we can't return as yet, because we need to register this decl in the current binding block. This
need to register this decl in the current binding block. */ ensures that we get an error message if it is redeclared as a
if (! DECL_EXTERNAL (x) || ! TREE_PUBLIC (x) local variable later in the same block. */
|| lookup_name (name) == t) if (! DECL_EXTERNAL (x) || ! TREE_PUBLIC (x))
return t; return t;
} }
...@@ -2422,7 +2422,7 @@ redeclaration_error_message (newdecl, olddecl) ...@@ -2422,7 +2422,7 @@ redeclaration_error_message (newdecl, olddecl)
external reference. Otherwise, it is OK, because newdecl must external reference. Otherwise, it is OK, because newdecl must
be an extern reference to olddecl. */ be an extern reference to olddecl. */
if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (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 "redeclaration of `%s'";
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment