From patchwork Thu Nov 15 21:53:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 199428 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 B410E2C0419 for ; Fri, 16 Nov 2012 08:55:11 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353621312; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Date:To:Subject:User-Agent: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=Is0dO7n 8lmP6ohaCFYT2UVldqtw=; b=STKfNNW91FPFzsnLXCXd1O7hIeCZEgc/Negx6wq ysdIWLCZZC9qFn2NDn8s85AyYsXYhvDnQoS35V7acHKOmWpiMlcqcuEJgYbmxawa AsSdHONi3z7s/SohCBZkLeIlKCMjNDcU4UlQQl4P/fBzYhBLi1N9Hau9W5fAGndt DrLY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Date:To:Subject:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=hxxg8H4ndozuhHkBR0ZkzSrdStpr4o/laCJWFo3XGTGK6cq6WYBYS4JqeG50Vj HBBfbRG2F/Y6SXD4NVNRHISa7RdEyFMk6NvS3NTw25rL3YgyKR0Z6kax/KVyWl4q XMld4+oqPfv/aylVI6Ntidd8lIXATRO+WlU9vM4f5eMjM=; Received: (qmail 10284 invoked by alias); 15 Nov 2012 21:54:05 -0000 Received: (qmail 10206 invoked by uid 22791); 15 Nov 2012 21:54:03 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_FN X-Spam-Check-By: sourceware.org Received: from mail-vb0-f73.google.com (HELO mail-vb0-f73.google.com) (209.85.212.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Nov 2012 21:53:43 +0000 Received: by mail-vb0-f73.google.com with SMTP id fs19so229721vbb.2 for ; Thu, 15 Nov 2012 13:53:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:to:subject:user-agent:mime-version:content-type :content-transfer-encoding:message-id:from:x-gm-message-state; bh=PjEleLf8ezsU4S9OHAsNwfGT53vCBxx5lC+EiDHRGtg=; b=S50B3gRXvmSYk6MdLaxCQGqbiw2wBqGk81aFln1v0gobODBYr34AhMIK4CqyU2y2qK /N+kbZ5qMQXsH0uG/C7jzLmc/hia5uDqz77QRzWZyJUEfTLylA2f5l4fPCkvznltu2mW pvsrfqGYWMvq7yh1rTmUPNwQhVeK3EItnqawq4TQZxWxQIjKNwliVks/+1S7V6yHhuJe 2LqKFnLU5h4GXAO3QTmJyy7w3gmVhtAvu1X4Xji6HBPxshfSpAwUyVBr7BUh1vHCzKDd vlmqWBF1TS8YBJ/O2uiBLoGW5ZMAM78NA58wDxNOGqxrGtwEa+AoL4PJLYMpitqCdTVD EEzw== Received: by 10.100.77.19 with SMTP id z19mr431621ana.27.1353016421910; Thu, 15 Nov 2012 13:53:41 -0800 (PST) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id h50si1369841yhi.3.2012.11.15.13.53.41 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 15 Nov 2012 13:53:41 -0800 (PST) Received: from torture.tor.corp.google.com (torture.tor.corp.google.com [172.30.222.16]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id B05251002F8; Thu, 15 Nov 2012 13:53:41 -0800 (PST) Received: by torture.tor.corp.google.com (Postfix, from userid 54752) id 6BF2CC0916; Thu, 15 Nov 2012 16:53:41 -0500 (EST) Date: Thu, 15 Nov 2012 16:53:41 -0500 To: iant@google.com, gcc-patches@gcc.gnu.org Subject: VEC re-write [patch 08/25] User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-Id: <20121115215341.6BF2CC0916@torture.tor.corp.google.com> From: dnovillo@google.com (Diego Novillo) X-Gm-Message-State: ALoCoQk8zw5V2mUhPPgx5HpiffgBe8yzAPBGGqST8zugA09mEJGNGbrKTUfauvi0bunSbLhOBfsLQiHrlUPX2N0fpnRftwYbE1y12jpW2RLPEaRIOUhTa82bYcPKXYHiTqbsGjF4dmbYPBz5USNYw6LO40NIejEQEJvq1iSUXQmdFLgi37E4GOp3Dcq0OBtQfRloXmmRrWnMbJSVzdv4LTgZvPPszk4atPypSHGtqMlIZVggV8K4VCs= 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 2012-11-15 Diego Novillo Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * go-lang.c: Use new vec API in vec.h. * gofrontend/expressions.cc: Likewise. * gofrontend/gogo-tree.cc: Likewise. * godump.c: Likewise. diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index f5229bb..8e7b8ba 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -157,16 +157,14 @@ go_langhook_init_options_struct (struct gcc_options *opts) opts->x_flag_non_call_exceptions = 1; } -/* Infrastructure for a VEC of char * pointers. */ +/* Infrastructure for a vector of char * pointers. */ typedef const char *go_char_p; -DEF_VEC_P(go_char_p); -DEF_VEC_ALLOC_P(go_char_p, heap); /* The list of directories to search after all the Go specific directories have been searched. */ -static VEC(go_char_p, heap) *go_search_dirs; +static vec go_search_dirs; /* Handle Go specific options. Return 0 if we didn't do anything. */ @@ -222,7 +220,7 @@ go_langhook_handle_option ( /* Search ARG too, but only after we've searched to Go specific directories for all -L arguments. */ - VEC_safe_push (go_char_p, heap, go_search_dirs, arg); + go_search_dirs.safe_push (arg); } break; @@ -264,10 +262,9 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) gcc_assert (num_in_fnames > 0); - FOR_EACH_VEC_ELT (go_char_p, go_search_dirs, ix, dir) + FOR_EACH_VEC_ELT (go_search_dirs, ix, dir) go_add_search_path (dir); - VEC_free (go_char_p, heap, go_search_dirs); - go_search_dirs = NULL; + go_search_dirs.release (); if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD; diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 8fe6146..8165da2 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -180,24 +180,25 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type, // Assigning nil to an open array. go_assert(TREE_CODE(lhs_type_tree) == RECORD_TYPE); - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3); + vec *init; + vec_alloc(init, 3); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(lhs_type_tree); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), null_pointer_node); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), integer_zero_node); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0); @@ -320,10 +321,11 @@ Expression::convert_type_to_interface(Translate_context* context, // Start building a constructor for the value we will return. - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2); + vec *init; + vec_alloc(init, 2); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(lhs_type_tree); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), (lhs_is_empty ? "__type_descriptor" : "__methods")) == 0); @@ -331,7 +333,7 @@ Expression::convert_type_to_interface(Translate_context* context, elt->value = fold_convert_loc(location.gcc_location(), TREE_TYPE(field), first_field_value); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0); elt->index = field; @@ -445,10 +447,11 @@ Expression::convert_interface_to_interface(Translate_context* context, // The result is going to be a two element constructor. - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2); + vec *init; + vec_alloc (init, 2); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(lhs_type_tree); elt->index = field; @@ -511,7 +514,7 @@ Expression::convert_interface_to_interface(Translate_context* context, // The second field is simply the object pointer. - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0); elt->index = field; @@ -9976,23 +9979,24 @@ Array_index_expression::do_get_tree(Translate_context* context) tree struct_tree = type_to_tree(this->type()->get_backend(gogo)); go_assert(TREE_CODE(struct_tree) == RECORD_TYPE); - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3); + vec *init; + vec_alloc (init, 3); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(struct_tree); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0); elt->index = field; elt->value = value_pointer; - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0); elt->index = field; elt->value = fold_convert_loc(loc.gcc_location(), TREE_TYPE(field), result_length_tree); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0); elt->index = field; @@ -11345,8 +11349,8 @@ Struct_construction_expression::do_get_tree(Translate_context* context) bool is_constant = true; const Struct_field_list* fields = this->type_->struct_type()->fields(); - VEC(constructor_elt,gc)* elts = VEC_alloc(constructor_elt, gc, - fields->size()); + vec *elts; + vec_alloc (elts, fields->size()); Struct_field_list::const_iterator pf = fields->begin(); Expression_list::const_iterator pv = this->vals_->begin(); for (tree field = TYPE_FIELDS(type_tree); @@ -11378,7 +11382,7 @@ Struct_construction_expression::do_get_tree(Translate_context* context) return error_mark_node; constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, elts, empty); + constructor_elt* elt = elts->quick_push(empty); elt->index = field; elt->value = val; if (!TREE_CONSTANT(val)) @@ -11588,10 +11592,8 @@ tree Array_construction_expression::get_constructor_tree(Translate_context* context, tree type_tree) { - VEC(constructor_elt,gc)* values = VEC_alloc(constructor_elt, gc, - (this->vals_ == NULL - ? 0 - : this->vals_->size())); + vec *values; + vec_alloc (values, (this->vals_ == NULL ? 0 : this->vals_->size())); Type* element_type = this->type_->array_type()->element_type(); bool is_constant = true; if (this->vals_ != NULL) @@ -11607,7 +11609,7 @@ Array_construction_expression::get_constructor_tree(Translate_context* context, if (this->indexes_ != NULL) go_assert(pi != this->indexes_->end()); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, values, empty); + constructor_elt* elt = values->quick_push(empty); if (this->indexes_ == NULL) elt->index = size_int(i); @@ -11816,9 +11818,10 @@ Open_array_construction_expression::do_get_tree(Translate_context* context) build_index_type(max)); if (constructor_type == error_mark_node) return error_mark_node; - VEC(constructor_elt,gc)* vec = VEC_alloc(constructor_elt, gc, 1); + vec *vec; + vec_alloc(vec, 1); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, vec, empty); + constructor_elt* elt = vec->quick_push(empty); elt->index = size_int(0); Gogo* gogo = context->gogo(); Btype* btype = element_type->get_backend(gogo); @@ -11909,22 +11912,23 @@ Open_array_construction_expression::do_get_tree(Translate_context* context) return error_mark_node; go_assert(TREE_CODE(type_tree) == RECORD_TYPE); - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3); + vec *init; + vec_alloc(init, 3); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(type_tree); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), space); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), length_tree); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),"__capacity") == 0); elt->index = field; @@ -12117,8 +12121,8 @@ Map_construction_expression::do_get_tree(Translate_context* context) } else { - VEC(constructor_elt,gc)* values = VEC_alloc(constructor_elt, gc, - this->vals_->size() / 2); + vec *values; + vec_alloc(values, this->vals_->size() / 2); for (Expression_list::const_iterator pv = this->vals_->begin(); pv != this->vals_->end(); @@ -12126,10 +12130,11 @@ Map_construction_expression::do_get_tree(Translate_context* context) { bool one_is_constant = true; - VEC(constructor_elt,gc)* one = VEC_alloc(constructor_elt, gc, 2); + vec *one; + vec_alloc(one, 2); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, one, empty); + constructor_elt* elt = one->quick_push(empty); elt->index = key_field; tree val_tree = (*pv)->get_tree(context); elt->value = Expression::convert_for_assignment(context, key_type, @@ -12142,7 +12147,7 @@ Map_construction_expression::do_get_tree(Translate_context* context) ++pv; - elt = VEC_quick_push(constructor_elt, one, empty); + elt = one->quick_push(empty); elt->index = val_field; val_tree = (*pv)->get_tree(context); elt->value = Expression::convert_for_assignment(context, val_type, @@ -12153,7 +12158,7 @@ Map_construction_expression::do_get_tree(Translate_context* context) if (!TREE_CONSTANT(elt->value)) one_is_constant = false; - elt = VEC_quick_push(constructor_elt, values, empty); + elt = values->quick_push(empty); elt->index = size_int(i); elt->value = build_constructor(struct_type, one); if (one_is_constant) diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index 2b0c26f..95ec70e 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -344,18 +344,19 @@ Gogo::register_gc_vars(const std::vector& var_gc, // Build an initialier for the __roots array. - VEC(constructor_elt,gc)* roots_init = VEC_alloc(constructor_elt, gc, - count + 1); + vec *roots_init; + vec_alloc(roots_init, count + 1); size_t i = 0; for (std::vector::const_iterator p = var_gc.begin(); p != var_gc.end(); ++p, ++i) { - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2); + vec *init; + vec_alloc(init, 2); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(root_type); elt->index = field; Bvariable* bvar = (*p)->get_backend_variable(this, NULL); @@ -363,45 +364,47 @@ Gogo::register_gc_vars(const std::vector& var_gc, go_assert(TREE_CODE(decl) == VAR_DECL); elt->value = build_fold_addr_expr(decl); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); elt->index = field; elt->value = DECL_SIZE_UNIT(decl); - elt = VEC_quick_push(constructor_elt, roots_init, empty); + elt = roots_init->quick_push(empty); elt->index = size_int(i); elt->value = build_constructor(root_type, init); } // The list ends with a NULL entry. - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2); + vec *init; + vec_alloc(init, 2); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(root_type); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), null_pointer_node); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); elt->index = field; elt->value = size_zero_node; - elt = VEC_quick_push(constructor_elt, roots_init, empty); + elt = roots_init->quick_push(empty); elt->index = size_int(i); elt->value = build_constructor(root_type, init); // Build a constructor for the struct. - VEC(constructor_elt,gc)* root_list_init = VEC_alloc(constructor_elt, gc, 2); + vec *root_list_init; + vec_alloc(root_list_init, 2); - elt = VEC_quick_push(constructor_elt, root_list_init, empty); + elt = root_list_init->quick_push(empty); field = TYPE_FIELDS(root_list_type); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), null_pointer_node); - elt = VEC_quick_push(constructor_elt, root_list_init, empty); + elt = root_list_init->quick_push(empty); field = DECL_CHAIN(field); elt->index = field; elt->value = build_constructor(array_type, roots_init); @@ -2030,10 +2033,11 @@ Gogo::go_string_constant_tree(const std::string& val) { tree string_type = type_to_tree(Type::make_string_type()->get_backend(this)); - VEC(constructor_elt, gc)* init = VEC_alloc(constructor_elt, gc, 2); + vec *init; + vec_alloc(init, 2); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); tree field = TYPE_FIELDS(string_type); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__data") == 0); elt->index = field; @@ -2041,7 +2045,7 @@ Gogo::go_string_constant_tree(const std::string& val) elt->value = fold_convert(TREE_TYPE(field), build_fold_addr_expr(str)); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__length") == 0); elt->index = field; @@ -2089,12 +2093,13 @@ Gogo::slice_constructor(tree slice_type_tree, tree values, tree count, { go_assert(TREE_CODE(slice_type_tree) == RECORD_TYPE); - VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3); + vec *init; + vec_alloc(init, 3); tree field = TYPE_FIELDS(slice_type_tree); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0); constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty); + constructor_elt* elt = init->quick_push(empty); elt->index = field; go_assert(TYPE_MAIN_VARIANT(TREE_TYPE(field)) == TYPE_MAIN_VARIANT(TREE_TYPE(values))); @@ -2109,13 +2114,13 @@ Gogo::slice_constructor(tree slice_type_tree, tree values, tree count, field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), count); field = DECL_CHAIN(field); go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0); - elt = VEC_quick_push(constructor_elt, init, empty); + elt = init->quick_push(empty); elt->index = field; elt->value = fold_convert(TREE_TYPE(field), capacity); @@ -2172,12 +2177,12 @@ Gogo::interface_method_table_for_type(const Interface_type* interface, } size_t count = interface_methods->size(); - VEC(constructor_elt, gc)* pointers = VEC_alloc(constructor_elt, gc, - count + 1); + vec *pointers; + vec_alloc(pointers, count + 1); // The first element is the type descriptor. constructor_elt empty = {NULL, NULL}; - constructor_elt* elt = VEC_quick_push(constructor_elt, pointers, empty); + constructor_elt* elt = pointers->quick_push(empty); elt->index = size_zero_node; Type* td_type; if (!is_pointer) @@ -2218,7 +2223,7 @@ Gogo::interface_method_table_for_type(const Interface_type* interface, go_unreachable(); fndecl = build_fold_addr_expr(fndecl); - elt = VEC_quick_push(constructor_elt, pointers, empty); + elt = pointers->quick_push(empty); elt->index = size_int(i); elt->value = fold_convert(const_ptr_type_node, fndecl); } diff --git a/gcc/godump.c b/gcc/godump.c index ab1edc6..22995fe 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -56,7 +56,7 @@ static FILE *go_dump_file; /* A queue of decls to output. */ -static GTY(()) VEC(tree,gc) *queue; +static GTY(()) vec *queue; /* A hash table of macros we have seen. */ @@ -480,7 +480,7 @@ go_decl (tree decl) || DECL_IS_BUILTIN (decl) || DECL_NAME (decl) == NULL_TREE) return; - VEC_safe_push (tree, gc, queue, decl); + vec_safe_push (queue, decl); } /* A function decl. */ @@ -515,7 +515,7 @@ go_type_decl (tree decl, int local) || TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) != IDENTIFIER_NODE) && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE) return; - VEC_safe_push (tree, gc, queue, decl); + vec_safe_push (queue, decl); } /* A container for the data we pass around when generating information @@ -1194,7 +1194,7 @@ go_finish (const char *filename) keyword_hash_init (&container); - FOR_EACH_VEC_ELT (tree, queue, ix, decl) + FOR_EACH_VEC_SAFE_ELT (queue, ix, decl) { switch (TREE_CODE (decl)) { @@ -1228,7 +1228,7 @@ go_finish (const char *filename) htab_delete (container.keyword_hash); obstack_free (&container.type_obstack, NULL); - queue = NULL; + vec_free (queue); if (fclose (go_dump_file) != 0) error ("could not close Go dump file: %m");