From patchwork Mon Jun 28 14:00:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 57142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0E015B6EFE for ; Tue, 29 Jun 2010 00:00:22 +1000 (EST) Received: (qmail 4173 invoked by alias); 28 Jun 2010 14:00:21 -0000 Received: (qmail 4122 invoked by uid 22791); 28 Jun 2010 14:00:20 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Jun 2010 14:00:14 +0000 Received: (qmail 26045 invoked from network); 28 Jun 2010 14:00:12 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Jun 2010 14:00:12 -0000 Date: Mon, 28 Jun 2010 07:00:12 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Subject: [PATCH,c++] convert named_label_entry.bad_decls to a VEC Message-ID: <20100628140012.GF22606@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org As $SUBJECT suggests. More TREE_LIST removal, hooray, hooray. Tested on x86_64-unknown-linux-gnu. OK to commit? -Nathan * 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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9541252..65c9b0d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -212,9 +212,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; @@ -471,7 +471,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; @@ -2652,6 +2652,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. */ @@ -2690,29 +2691,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)