(shadow_label): Emit an error if the label is already
declared at this label scope. From-SVN: r8191
This commit is contained in:
parent
b5eda7762d
commit
a784882b53
15
gcc/c-decl.c
15
gcc/c-decl.c
@ -2440,6 +2440,21 @@ shadow_label (name)
|
||||
|
||||
if (decl != 0)
|
||||
{
|
||||
register tree dup;
|
||||
|
||||
/* Check to make sure that the label hasn't already been declared
|
||||
at this label scope */
|
||||
for (dup = named_labels; dup; dup = TREE_CHAIN (dup))
|
||||
if (TREE_VALUE (dup) == decl)
|
||||
{
|
||||
error ("duplicate label declaration `%s'",
|
||||
IDENTIFIER_POINTER (name));
|
||||
error_with_decl (TREE_VALUE (dup),
|
||||
"this is a previous declaration");
|
||||
/* Just use the previous declaration. */
|
||||
return lookup_label (name);
|
||||
}
|
||||
|
||||
shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
|
||||
IDENTIFIER_LABEL_VALUE (name) = decl = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user