diff options
author | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-30 01:24:53 +0000 |
---|---|---|
committer | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-30 01:24:53 +0000 |
commit | 6c0d9c8de91cfe5074f25f2f2d50952c9e7e2eb4 (patch) | |
tree | 077f4ae1da8623043bc11d8288b91179b402d857 /gcc/cp | |
parent | bde2eab67c0f63e6dcafc495585ee57d7d810adf (diff) | |
download | gcc-6c0d9c8de91cfe5074f25f2f2d50952c9e7e2eb4.tar.gz |
* decl.c (struct named_label_entry): Change type of bad_decls field
to a VEC.
(poplevel_named_label_1): Adjust for new type of bad_decls.
(check_goto): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161583 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 22 |
2 files changed, 18 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e0646a1d9a0..27ab92fe267 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2010-06-29 Nathan Froyd <froydnj@codesourcery.com> + + * decl.c (struct named_label_entry): Change type of bad_decls field + to a VEC. + (poplevel_named_label_1): Adjust for new type of bad_decls. + (check_goto): Likewise. + 2010-06-29 Jason Merrill <jason@redhat.com> Enable implicitly declared move constructor/operator= (N3053). diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 153bd539d58..47d64ca3a53 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -211,9 +211,9 @@ struct GTY(()) named_label_entry { defined, or the inner scope popped. These are the decls that will be skipped when jumping to the label. */ tree names_in_scope; - /* A tree list of all decls from all binding levels that would be + /* A vector of all decls from all binding levels that would be crossed by a backward branch to the label. */ - tree bad_decls; + VEC(tree,gc) *bad_decls; /* A list of uses of the label, before the label is defined. */ struct named_label_use_entry *uses; @@ -470,7 +470,7 @@ poplevel_named_label_1 (void **slot, void *data) for (decl = ent->names_in_scope; decl; decl = TREE_CHAIN (decl)) if (decl_jump_unsafe (decl)) - ent->bad_decls = tree_cons (NULL, decl, ent->bad_decls); + VEC_safe_push (tree, gc, ent->bad_decls, decl); ent->binding_level = obl; ent->names_in_scope = obl->names; @@ -2651,6 +2651,7 @@ check_goto (tree decl) struct named_label_entry *ent, dummy; bool saw_catch = false, identified = false; tree bad; + unsigned ix; /* We can't know where a computed goto is jumping. So we assume that it's OK. */ @@ -2689,29 +2690,28 @@ check_goto (tree decl) } if (ent->in_try_scope || ent->in_catch_scope - || ent->in_omp_scope || ent->bad_decls) + || ent->in_omp_scope || !VEC_empty (tree, ent->bad_decls)) { permerror (input_location, "jump to label %q+D", decl); permerror (input_location, " from here"); identified = true; } - for (bad = ent->bad_decls; bad; bad = TREE_CHAIN (bad)) + for (ix = 0; VEC_iterate (tree, ent->bad_decls, ix, bad); ix++) { - tree b = TREE_VALUE (bad); - int u = decl_jump_unsafe (b); + int u = decl_jump_unsafe (bad); - if (u > 1 && DECL_ARTIFICIAL (b)) + if (u > 1 && DECL_ARTIFICIAL (bad)) { /* Can't skip init of __exception_info. */ - error_at (DECL_SOURCE_LOCATION (b), " enters catch block"); + error_at (DECL_SOURCE_LOCATION (bad), " enters catch block"); saw_catch = true; } else if (u > 1) - error (" skips initialization of %q+#D", b); + error (" skips initialization of %q+#D", bad); else permerror (input_location, " enters scope of %q+#D which has " - "non-trivial destructor", b); + "non-trivial destructor", bad); } if (ent->in_try_scope) |