aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Cohen <wcohen@redhat.com>2000-12-05 16:21:54 +0000
committerWilliam Cohen <wcohen@gcc.gnu.org>2000-12-05 16:21:54 +0000
commit3dc9aec61fefd723e28780c84e83b9c5d2219186 (patch)
treea8a66e35983e04131f75782b10f0c10ddc5cc82c
parentcbb409451baa17eed88f57e0b575ff5f6b01fab5 (diff)
downloadgcc-3dc9aec61fefd723e28780c84e83b9c5d2219186.zip
gcc-3dc9aec61fefd723e28780c84e83b9c5d2219186.tar.gz
gcc-3dc9aec61fefd723e28780c84e83b9c5d2219186.tar.bz2
Modification to define_label and finish_case_label in decl.c to handle
scoping correctly. From-SVN: r38041
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 10fff7f..7358f65 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2000-12-05 Will Cohen <wcohen@redhat.com>
+
+ * decl.c (finish_case_label): Cleared
+ more_cleanups_ok in surrounding function scopes.
+ (define_label): Likewise.
+
2000-12-05 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (IDENTIFIER_VIRTUAL_P): Document.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 24b24df..d68c300 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5068,14 +5068,16 @@ define_label (filename, line, name)
{
tree decl = lookup_label (name);
struct named_label_list *ent;
+ register struct binding_level *p;
for (ent = named_labels; ent; ent = ent->next)
if (ent->label_decl == decl)
break;
- /* After labels, make any new cleanups go into their
+ /* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- current_binding_level->more_cleanups_ok = 0;
+ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain)
+ p->more_cleanups_ok = 0;
if (name == get_identifier ("wchar_t"))
cp_pedwarn ("label named wchar_t");
@@ -5161,6 +5163,7 @@ finish_case_label (low_value, high_value)
tree high_value;
{
tree cond;
+ register struct binding_level *p;
if (! switch_stack)
{
@@ -5194,9 +5197,10 @@ finish_case_label (low_value, high_value)
check_switch_goto (switch_stack->level);
- /* After labels, make any new cleanups go into their
+ /* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- current_binding_level->more_cleanups_ok = 0;
+ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain)
+ p->more_cleanups_ok = 0;
current_function_return_value = NULL_TREE;
}