From 407dc10874de9496b783d3847791eb9544324ca6 Mon Sep 17 00:00:00 2001 From: erich Date: Sat, 1 Oct 1994 10:58:44 +0000 Subject: [PATCH] (shadow_label): Emit an error if the label is already declared at this label scope. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8191 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 57796336188..fa16ad7c4a3 100644 --- a/gcc/c-decl.c +++ b/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; } -- 2.11.4.GIT