summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2012-09-10 20:04:13 -0400
committerDiego Novillo <dnovillo@gcc.gnu.org>2012-09-10 20:04:13 -0400
commitf32682ca2516e009432be7f0dc0e4e4bfab9a944 (patch)
tree3030f0ec079f1a93f960208e432eb6f275d10a28
parentda4c5b2465322894e6d53cd14128ba21d0ff911b (diff)
downloadgcc-f32682ca2516e009432be7f0dc0e4e4bfab9a944.tar.gz
Remove unnecessary VEC function overloads.
Several VEC member functions that accept an element 'T' used to have two overloads: one taking 'T', the second taking 'T *'. This used to be needed because of the interface dichotomy between vectors of objects and vectors of pointers. In the past, vectors of pointers would use pass-by-value semantics, but vectors of objects would use pass-by-reference semantics. This is no longer necessary, but the distinction had remained. The main side-effect of this change is some code reduction in code that manipulates vectors of objects. For instance, - struct iterator_use *iuse; - - iuse = VEC_safe_push (iterator_use, heap, iterator_uses, NULL); - iuse->iterator = iterator; - iuse->ptr = ptr; + struct iterator_use iuse = {iterator, ptr}; + VEC_safe_push (iterator_use, heap, iterator_uses, iuse); Compile time performance was not affected. Tested on x86_64 and ppc64. Also built all-gcc on all targets using VEC routines: arm, bfin, c6x, epiphany, ia64, mips, sh, spu, and vms. 2012-09-10 Diego Novillo <dnovillo@google.com> * vec.h (vec_t::quick_push): Remove overload that accepts 'T *'. Update all users. (vec_t::safe_push): Likewise. (vec_t::quick_insert): Likewise. (vec_t::lower_bound): Likewise. (vec_t::safe_insert): Likewise. (vec_t::replace): Change second argument to 'T &'. From-SVN: r191165
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/ada/gcc-interface/decl.c13
-rw-r--r--gcc/ada/gcc-interface/utils.c11
-rw-r--r--gcc/alias.c4
-rw-r--r--gcc/c-family/c-common.c2
-rw-r--r--gcc/c-family/c-pragma.c15
-rw-r--r--gcc/c/c-decl.c8
-rw-r--r--gcc/c/c-tree.h4
-rw-r--r--gcc/c/c-typeck.c6
-rw-r--r--gcc/config/mips/mips.c4
-rw-r--r--gcc/config/pa/pa.c6
-rw-r--r--gcc/config/rs6000/rs6000-c.c7
-rw-r--r--gcc/config/rs6000/rs6000.c7
-rw-r--r--gcc/cp/class.c8
-rw-r--r--gcc/cp/decl.c16
-rw-r--r--gcc/cp/except.c7
-rw-r--r--gcc/cp/init.c27
-rw-r--r--gcc/cp/name-lookup.c20
-rw-r--r--gcc/cp/parser.c21
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/cp/semantics.c20
-rw-r--r--gcc/dwarf2cfi.c58
-rw-r--r--gcc/dwarf2out.c30
-rw-r--r--gcc/emit-rtl.c2
-rw-r--r--gcc/except.c6
-rw-r--r--gcc/fortran/trans-openmp.c5
-rw-r--r--gcc/fwprop.c2
-rw-r--r--gcc/gcc.c2
-rw-r--r--gcc/gcse.c8
-rw-r--r--gcc/genautomata.c5
-rw-r--r--gcc/genextract.c2
-rw-r--r--gcc/genopinit.c2
-rw-r--r--gcc/gimple-low.c2
-rw-r--r--gcc/go/gofrontend/expressions.cc47
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc35
-rw-r--r--gcc/graphite-sese-to-poly.c2
-rw-r--r--gcc/ipa-inline-analysis.c8
-rw-r--r--gcc/ipa-prop.c45
-rw-r--r--gcc/ipa-split.c4
-rw-r--r--gcc/java/class.c7
-rw-r--r--gcc/java/expr.c5
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/objc/objc-next-runtime-abi-02.c14
-rw-r--r--gcc/opts-common.c8
-rw-r--r--gcc/read-rtl.c15
-rw-r--r--gcc/ree.c7
-rw-r--r--gcc/reload1.c9
-rw-r--r--gcc/sel-sched-ir.c2
-rw-r--r--gcc/tree-call-cdce.c4
-rw-r--r--gcc/tree-data-ref.c20
-rw-r--r--gcc/tree-dfa.c2
-rw-r--r--gcc/tree-diagnostic.c2
-rw-r--r--gcc/tree-emutls.c28
-rw-r--r--gcc/tree-sra.c39
-rw-r--r--gcc/tree-ssa-dom.c6
-rw-r--r--gcc/tree-ssa-pre.c2
-rw-r--r--gcc/tree-ssa-reassoc.c4
-rw-r--r--gcc/tree-ssa-sccvn.c16
-rw-r--r--gcc/tree-ssa-structalias.c82
-rw-r--r--gcc/tree-ssa.c2
-rw-r--r--gcc/tree-switch-conversion.c19
-rw-r--r--gcc/tree-vect-generic.c5
-rw-r--r--gcc/tree-vect-loop-manip.c2
-rw-r--r--gcc/tree-vect-slp.c4
-rw-r--r--gcc/tree-vectorizer.h2
-rw-r--r--gcc/tree-vrp.c2
-rw-r--r--gcc/tree.c6
-rw-r--r--gcc/tree.h5
-rw-r--r--gcc/var-tracking.c16
-rw-r--r--gcc/varasm.c21
-rw-r--r--gcc/vec.h149
71 files changed, 410 insertions, 580 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d75157f9f6c..0bfbcaab39e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2012-09-10 Diego Novillo <dnovillo@google.com>
+
+ * vec.h (vec_t::quick_push): Remove overload that accepts 'T *'.
+ Update all users.
+ (vec_t::safe_push): Likewise.
+ (vec_t::quick_insert): Likewise.
+ (vec_t::lower_bound): Likewise.
+ (vec_t::safe_insert): Likewise.
+ (vec_t::replace): Change second argument to 'T &'.
+
2012-09-10 Maciej W. Rozycki <macro@codesourcery.com>
* config/rs6000/rs6000.md: Move a splitter next to its insn.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index cb0f074d7d2..9e14d8af1bf 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -7507,9 +7507,8 @@ build_subst_list (Entity_Id gnat_subtype, Entity_Id gnat_type, bool definition)
(Node (gnat_value), gnat_subtype,
get_entity_name (gnat_discrim),
definition, true, false));
- subst_pair *s = VEC_safe_push (subst_pair, heap, gnu_list, NULL);
- s->discriminant = gnu_field;
- s->replacement = replacement;
+ subst_pair s = {gnu_field, replacement};
+ VEC_safe_push (subst_pair, heap, gnu_list, s);
}
return gnu_list;
@@ -7541,14 +7540,10 @@ build_variant_list (tree qual_union_type, VEC(subst_pair,heap) *subst_list,
still be accessed. */
if (!integer_zerop (qual))
{
- variant_desc *v;
tree variant_type = TREE_TYPE (gnu_field), variant_subpart;
+ variant_desc v = {variant_type, gnu_field, qual, NULL_TREE};
- v = VEC_safe_push (variant_desc, heap, gnu_list, NULL);
- v->type = variant_type;
- v->field = gnu_field;
- v->qual = qual;
- v->new_type = NULL_TREE;
+ VEC_safe_push (variant_desc, heap, gnu_list, v);
/* Recurse on the variant subpart of the variant, if any. */
variant_subpart = get_variant_part (variant_type);
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 4cca41bbf39..d9121c1931e 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -4615,16 +4615,14 @@ convert (tree type, tree expr)
FOR_EACH_CONSTRUCTOR_ELT(e, idx, index, value)
{
- constructor_elt *elt;
/* We expect only simple constructors. */
if (!SAME_FIELD_P (index, efield))
break;
/* The field must be the same. */
if (!SAME_FIELD_P (efield, field))
break;
- elt = VEC_quick_push (constructor_elt, v, NULL);
- elt->index = field;
- elt->value = convert (TREE_TYPE (field), value);
+ constructor_elt elt = {field, convert (TREE_TYPE (field), value)};
+ VEC_quick_push (constructor_elt, v, elt);
/* If packing has made this field a bitfield and the input
value couldn't be emitted statically any more, we need to
@@ -4690,9 +4688,8 @@ convert (tree type, tree expr)
v = VEC_alloc (constructor_elt, gc, len);
FOR_EACH_CONSTRUCTOR_VALUE (e, ix, value)
{
- constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
- elt->index = NULL_TREE;
- elt->value = value;
+ constructor_elt elt = {NULL_TREE, value};
+ VEC_quick_push (constructor_elt, v, elt);
}
expr = copy_node (expr);
TREE_TYPE (expr) = type;
diff --git a/gcc/alias.c b/gcc/alias.c
index 1df3529e942..0c6a7442b84 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -855,8 +855,8 @@ new_alias_set (void)
if (flag_strict_aliasing)
{
if (alias_sets == 0)
- VEC_safe_push (alias_set_entry, gc, alias_sets, (alias_set_entry) 0);
- VEC_safe_push (alias_set_entry, gc, alias_sets, (alias_set_entry) 0);
+ VEC_safe_push (alias_set_entry, gc, alias_sets, 0);
+ VEC_safe_push (alias_set_entry, gc, alias_sets, 0);
return VEC_length (alias_set_entry, alias_sets) - 1;
}
else
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 502613ae8df..6de2f1c81fd 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8535,7 +8535,7 @@ parse_optimize_options (tree args, bool attr_p)
/* Build up argv vector. Just in case the string is stored away, use garbage
collected strings. */
VEC_truncate (const_char_p, optimize_args, 0);
- VEC_safe_push (const_char_p, gc, optimize_args, (const_char_p)NULL);
+ VEC_safe_push (const_char_p, gc, optimize_args, NULL);
for (ap = args; ap != NULL_TREE; ap = TREE_CHAIN (ap))
{
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 77ed0f03325..70d8748ece9 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -372,10 +372,8 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy))
}
else
{
- pending_weak *pe;
- pe = VEC_safe_push (pending_weak, gc, pending_weaks, NULL);
- pe->name = name;
- pe->value = value;
+ pending_weak pe = {name, value};
+ VEC_safe_push (pending_weak, gc, pending_weaks, pe);
}
}
@@ -499,9 +497,8 @@ add_to_renaming_pragma_list (tree oldname, tree newname)
return;
}
- p = VEC_safe_push (pending_redefinition, gc, pending_redefine_extname, NULL);
- p->oldname = oldname;
- p->newname = newname;
+ pending_redefinition e = {oldname, newname};
+ VEC_safe_push (pending_redefinition, gc, pending_redefine_extname, e);
}
/* The current prefix set by #pragma extern_prefix. */
@@ -1236,14 +1233,14 @@ c_register_pragma_1 (const char *space, const char *name,
ns_name.space = space;
ns_name.name = name;
- VEC_safe_push (pragma_ns_name, heap, registered_pp_pragmas, &ns_name);
+ VEC_safe_push (pragma_ns_name, heap, registered_pp_pragmas, ns_name);
id = VEC_length (pragma_ns_name, registered_pp_pragmas);
id += PRAGMA_FIRST_EXTERNAL - 1;
}
else
{
VEC_safe_push (internal_pragma_handler, heap, registered_pragmas,
- &ihandler);
+ ihandler);
id = VEC_length (internal_pragma_handler, registered_pragmas);
id += PRAGMA_FIRST_EXTERNAL - 1;
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index e5d17b7ec99..d4c7b1f872e 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -6437,7 +6437,7 @@ get_parm_info (bool ellipsis, tree expr)
{
tree decl = b->decl;
tree type = TREE_TYPE (decl);
- c_arg_tag *tag;
+ c_arg_tag tag;
const char *keyword;
switch (TREE_CODE (decl))
@@ -6511,9 +6511,9 @@ get_parm_info (bool ellipsis, tree expr)
}
}
- tag = VEC_safe_push (c_arg_tag, gc, tags, NULL);
- tag->id = b->id;
- tag->type = decl;
+ tag.id = b->id;
+ tag.type = decl;
+ VEC_safe_push (c_arg_tag, gc, tags, tag);
break;
case CONST_DECL:
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index c07d994975d..17fc719b49d 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -142,8 +142,8 @@ DEF_VEC_ALLOC_O (c_expr_t, heap);
/* Append a new c_expr_t element to V. */
#define C_EXPR_APPEND(V, ELEM) \
do { \
- c_expr_t *__elem_p = VEC_safe_push (c_expr_t, gc, V, NULL); \
- *__elem_p = (ELEM); \
+ c_expr_t __elem = (ELEM); \
+ VEC_safe_push (c_expr_t, gc, V, __elem); \
} while (0)
/* A kind of type specifier. Note that this information is currently
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 99920ef288b..b5fb9c984ee 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -7709,7 +7709,6 @@ output_init_element (tree value, tree origtype, bool strict_string, tree type,
struct obstack * braced_init_obstack)
{
tree semantic_type = NULL_TREE;
- constructor_elt *celt;
bool maybe_const = true;
bool npc;
@@ -7876,9 +7875,8 @@ output_init_element (tree value, tree origtype, bool strict_string, tree type,
/* Otherwise, output this element either to
constructor_elements or to the assembler file. */
- celt = VEC_safe_push (constructor_elt, gc, constructor_elements, NULL);
- celt->index = field;
- celt->value = value;
+ constructor_elt celt = {field, value};
+ VEC_safe_push (constructor_elt, gc, constructor_elements, celt);
/* Advance the variable that indicates sequential elements output. */
if (TREE_CODE (constructor_type) == ARRAY_TYPE)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 09322f15926..7f9df4c161b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3989,8 +3989,8 @@ mips_multi_start (void)
static struct mips_multi_member *
mips_multi_add (void)
{
- return VEC_safe_push (mips_multi_member, heap, mips_multi_members,
- (struct mips_multi_member *) 0);
+ mips_multi_member empty;
+ return VEC_safe_push (mips_multi_member, heap, mips_multi_members, empty);
}
/* Add a normal insn with the given asm format to the current multi-insn
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index cba8e781722..6c8f8278d58 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -9948,11 +9948,9 @@ static GTY(()) VEC(extern_symbol,gc) *extern_symbols;
void
pa_hpux_asm_output_external (FILE *file, tree decl, const char *name)
{
- extern_symbol * p = VEC_safe_push (extern_symbol, gc, extern_symbols, NULL);
-
gcc_assert (file == asm_out_file);
- p->decl = decl;
- p->name = name;
+ extern_symbol p = {decl, name};
+ VEC_safe_push (extern_symbol, gc, extern_symbols, p);
}
/* Output text required at the end of an assembler file.
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index a2ef08e17ca..58101ab4bff 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -3582,11 +3582,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
vec = VEC_alloc (constructor_elt, gc, size);
for(i = 0; i < size; i++)
{
- constructor_elt *elt;
-
- elt = VEC_quick_push (constructor_elt, vec, NULL);
- elt->index = NULL_TREE;
- elt->value = arg;
+ constructor_elt elt = {NULL_TREE, arg};
+ VEC_quick_push (constructor_elt, vec, elt);
}
return build_constructor (type, vec);
}
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c125019e821..a5a3848e585 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -24901,11 +24901,8 @@ static void
add_compiler_branch_island (tree label_name, tree function_name,
int line_number)
{
- branch_island *bi = VEC_safe_push (branch_island, gc, branch_islands, NULL);
-
- bi->function_name = function_name;
- bi->label_name = label_name;
- bi->line_number = line_number;
+ branch_island bi = {function_name, label_name, line_number};
+ VEC_safe_push (branch_island, gc, branch_islands, bi);
}
/* Generate far-jump branch islands for everything recorded in
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 13d9c768509..7abcc7e0da8 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -8835,11 +8835,9 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
offset. */
if (vid->binfo == TYPE_BINFO (vid->derived))
{
- tree_pair_p elt = VEC_safe_push (tree_pair_s, gc,
- CLASSTYPE_VCALL_INDICES (vid->derived),
- NULL);
- elt->purpose = orig_fn;
- elt->value = vid->index;
+ tree_pair_s elt = {orig_fn, vid->index};
+ VEC_safe_push (tree_pair_s, gc, CLASSTYPE_VCALL_INDICES (vid->derived),
+ elt);
}
/* The next vcall offset will be found at a more negative
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e34092d58e6..1f33bf9116f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2639,16 +2639,16 @@ tree
declare_local_label (tree id)
{
tree decl;
- cp_label_binding *bind;
+ cp_label_binding bind;
/* Add a new entry to the SHADOWED_LABELS list so that when we leave
this scope we can restore the old value of IDENTIFIER_TYPE_VALUE. */
- bind = VEC_safe_push (cp_label_binding, gc,
- current_binding_level->shadowed_labels, NULL);
- bind->prev_value = IDENTIFIER_LABEL_VALUE (id);
+ bind.prev_value = IDENTIFIER_LABEL_VALUE (id);
decl = make_label_decl (id, /*local_p=*/1);
- bind->label = decl;
+ bind.label = decl;
+ VEC_safe_push (cp_label_binding, gc, current_binding_level->shadowed_labels,
+ bind);
return decl;
}
@@ -13782,10 +13782,8 @@ maybe_register_incomplete_var (tree var)
|| (TYPE_LANG_SPECIFIC (inner_type)
&& TYPE_BEING_DEFINED (inner_type)))
{
- incomplete_var *iv
- = VEC_safe_push (incomplete_var, gc, incomplete_vars, NULL);
- iv->decl = var;
- iv->incomplete_type = inner_type;
+ incomplete_var iv = {var, inner_type};
+ VEC_safe_push (incomplete_var, gc, incomplete_vars, iv);
}
}
}
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index ff967de37f7..da3441856e2 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1249,11 +1249,8 @@ expr_noexcept_p (tree expr, tsubst_flags_t complain)
if (!DECL_INITIAL (fn))
{
/* Not defined yet; check again at EOF. */
- pending_noexcept *p
- = VEC_safe_push (pending_noexcept, gc,
- pending_noexcept_checks, NULL);
- p->fn = fn;
- p->loc = input_location;
+ pending_noexcept p = {fn, input_location};
+ VEC_safe_push (pending_noexcept, gc, pending_noexcept_checks, p);
}
else
maybe_noexcept_warning (fn);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 561477ace57..23d86d5b147 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -253,21 +253,21 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
have an upper bound of -1. */
if (!tree_int_cst_equal (max_index, integer_minus_one_node))
{
- constructor_elt *ce;
+ constructor_elt ce;
v = VEC_alloc (constructor_elt, gc, 1);
- ce = VEC_quick_push (constructor_elt, v, NULL);
/* If this is a one element array, we just use a regular init. */
if (tree_int_cst_equal (size_zero_node, max_index))
- ce->index = size_zero_node;
+ ce.index = size_zero_node;
else
- ce->index = build2 (RANGE_EXPR, sizetype, size_zero_node,
+ ce.index = build2 (RANGE_EXPR, sizetype, size_zero_node,
max_index);
- ce->value = build_zero_init_1 (TREE_TYPE (type),
+ ce.value = build_zero_init_1 (TREE_TYPE (type),
/*nelts=*/NULL_TREE,
static_storage_p, NULL_TREE);
+ VEC_quick_push (constructor_elt, v, ce);
}
/* Build a constructor to contain the initializations. */
@@ -448,28 +448,27 @@ build_value_init_noctor (tree type, tsubst_flags_t complain)
have an upper bound of -1. */
if (!tree_int_cst_equal (max_index, integer_minus_one_node))
{
- constructor_elt *ce;
+ constructor_elt ce;
v = VEC_alloc (constructor_elt, gc, 1);
- ce = VEC_quick_push (constructor_elt, v, NULL);
/* If this is a one element array, we just use a regular init. */
if (tree_int_cst_equal (size_zero_node, max_index))
- ce->index = size_zero_node;
+ ce.index = size_zero_node;
else
- ce->index = build2 (RANGE_EXPR, sizetype, size_zero_node,
- max_index);
+ ce.index = build2 (RANGE_EXPR, sizetype, size_zero_node, max_index);
- ce->value = build_value_init (TREE_TYPE (type), complain);
+ ce.value = build_value_init (TREE_TYPE (type), complain);
+ VEC_quick_push (constructor_elt, v, ce);
- if (ce->value == error_mark_node)
+ if (ce.value == error_mark_node)
return error_mark_node;
/* We shouldn't have gotten here for anything that would need
non-trivial initialization, and gimplify_init_ctor_preeval
would need to be fixed to allow it. */
- gcc_assert (TREE_CODE (ce->value) != TARGET_EXPR
- && TREE_CODE (ce->value) != AGGR_INIT_EXPR);
+ gcc_assert (TREE_CODE (ce.value) != TARGET_EXPR
+ && TREE_CODE (ce.value) != AGGR_INIT_EXPR);
}
/* Build a constructor to contain the initializations. */
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 9392c01dc94..e4e982764c3 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -318,13 +318,9 @@ cxx_binding_free (cxx_binding *binding)
static cxx_binding *
new_class_binding (tree name, tree value, tree type, cp_binding_level *scope)
{
- cp_class_binding *cb;
- cxx_binding *binding;
-
- cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL);
-
- cb->identifier = name;
- cb->base = binding = cxx_binding_make (value, type);
+ cp_class_binding cb = {cxx_binding_make (value, type), name};
+ cxx_binding *binding = cb.base;
+ VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, cb);
binding->scope = scope;
return binding;
}
@@ -5884,16 +5880,16 @@ store_binding_p (tree id)
static void
store_binding (tree id, VEC(cxx_saved_binding,gc) **old_bindings)
{
- cxx_saved_binding *saved;
+ cxx_saved_binding saved;
gcc_checking_assert (store_binding_p (id));
IDENTIFIER_MARKED (id) = 1;
- saved = VEC_quick_push (cxx_saved_binding, *old_bindings, NULL);
- saved->identifier = id;
- saved->binding = IDENTIFIER_BINDING (id);
- saved->real_type_value = REAL_IDENTIFIER_TYPE_VALUE (id);
+ saved.identifier = id;
+ saved.binding = IDENTIFIER_BINDING (id);
+ saved.real_type_value = REAL_IDENTIFIER_TYPE_VALUE (id);
+ VEC_quick_push (cxx_saved_binding, *old_bindings, saved);
IDENTIFIER_BINDING (id) = NULL;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 327ad0b2c7d..b641e083533 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -590,13 +590,13 @@ cp_lexer_new_main (void)
lexer = cp_lexer_alloc ();
/* Put the first token in the buffer. */
- VEC_quick_push (cp_token, lexer->buffer, &token);
+ VEC_quick_push (cp_token, lexer->buffer, token);
/* Get the remaining tokens from the preprocessor. */
while (token.type != CPP_EOF)
{
cp_lexer_get_preprocessor_token (lexer, &token);
- VEC_safe_push (cp_token, gc, lexer->buffer, &token);
+ VEC_safe_push (cp_token, gc, lexer->buffer, token);
}
lexer->last_token = VEC_address (cp_token, lexer->buffer)
@@ -1731,11 +1731,8 @@ cp_parser_context_new (cp_parser_context* next)
static void
push_unparsed_function_queues (cp_parser *parser)
{
- VEC_safe_push (cp_unparsed_functions_entry, gc,
- parser->unparsed_queues, NULL);
- unparsed_funs_with_default_args = NULL;
- unparsed_funs_with_definitions = make_tree_vector ();
- unparsed_nsdmis = NULL;
+ cp_unparsed_functions_entry e = {NULL, make_tree_vector (), NULL};
+ VEC_safe_push (cp_unparsed_functions_entry, gc, parser->unparsed_queues, e);
}
static void
@@ -8028,7 +8025,7 @@ start_lambda_scope (tree decl)
decl = current_function_decl;
ti.t = lambda_scope;
ti.i = lambda_count;
- VEC_safe_push (tree_int, gc, lambda_scope_stack, &ti);
+ VEC_safe_push (tree_int, gc, lambda_scope_stack, ti);
if (lambda_scope != decl)
{
/* Don't reset the count if we're still in the same function. */
@@ -21758,11 +21755,9 @@ cp_parser_save_default_args (cp_parser* parser, tree decl)
probe = TREE_CHAIN (probe))
if (TREE_PURPOSE (probe))
{
- cp_default_arg_entry *entry
- = VEC_safe_push (cp_default_arg_entry, gc,
- unparsed_funs_with_default_args, NULL);
- entry->class_type = current_class_type;
- entry->decl = decl;
+ cp_default_arg_entry entry = {current_class_type, decl};
+ VEC_safe_push (cp_default_arg_entry, gc,
+ unparsed_funs_with_default_args, entry);
break;
}
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a87552827a9..768f141accf 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -20390,7 +20390,7 @@ append_type_to_template_for_access_check_1 (tree t,
VEC_safe_push (qualified_typedef_usage_t, gc,
TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (ti),
- &typedef_usage);
+ typedef_usage);
}
/* Append TYPE_DECL to the template TEMPL.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 642e15d553d..a6cdfb56889 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -145,11 +145,8 @@ push_deferring_access_checks (deferring_kind deferring)
deferred_access_no_check++;
else
{
- deferred_access *ptr;
-
- ptr = VEC_safe_push (deferred_access, gc, deferred_access_stack, NULL);
- ptr->deferred_access_checks = NULL;
- ptr->deferring_access_checks_kind = deferring;
+ deferred_access e = {NULL, deferring};
+ VEC_safe_push (deferred_access, gc, deferred_access_stack, e);
}
}
@@ -243,7 +240,7 @@ pop_to_parent_deferring_access_checks (void)
}
/* Insert into parent's checks. */
VEC_safe_push (deferred_access_check, gc,
- ptr->deferred_access_checks, chk);
+ ptr->deferred_access_checks, *chk);
found:;
}
}
@@ -311,7 +308,6 @@ perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl,
int i;
deferred_access *ptr;
deferred_access_check *chk;
- deferred_access_check *new_access;
/* Exit if we are in a context that no access checking is performed.
@@ -341,13 +337,9 @@ perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl,
}
}
/* If not, record the check. */
- new_access =
- VEC_safe_push (deferred_access_check, gc,
- ptr->deferred_access_checks, 0);
- new_access->binfo = binfo;
- new_access->decl = decl;
- new_access->diag_decl = diag_decl;
- new_access->loc = input_location;
+ deferred_access_check new_access = {binfo, decl, diag_decl, input_location};
+ VEC_safe_push (deferred_access_check, gc, ptr->deferred_access_checks,
+ new_access);
return true;
}
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 17027857bab..355c74698aa 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -941,10 +941,8 @@ record_reg_saved_in_reg (rtx dest, rtx src)
if (dest == NULL)
return;
- elt = VEC_safe_push (reg_saved_in_data, heap,
- cur_trace->regs_saved_in_regs, NULL);
- elt->orig_reg = src;
- elt->saved_in_reg = dest;
+ reg_saved_in_data e = {src, dest};
+ VEC_safe_push (reg_saved_in_data, heap, cur_trace->regs_saved_in_regs, e);
}
/* Add an entry to QUEUED_REG_SAVES saying that REG is now saved at
@@ -954,20 +952,19 @@ static void
queue_reg_save (rtx reg, rtx sreg, HOST_WIDE_INT offset)
{
queued_reg_save *q;
+ queued_reg_save e = {reg, sreg, offset};
size_t i;
/* Duplicates waste space, but it's also necessary to remove them
for correctness, since the queue gets output in reverse order. */
FOR_EACH_VEC_ELT (queued_reg_save, queued_reg_saves, i, q)
if (compare_reg_or_pc (q->reg, reg))
- goto found;
-
- q = VEC_safe_push (queued_reg_save, heap, queued_reg_saves, NULL);
+ {
+ *q = e;
+ return;
+ }
- found:
- q->reg = reg;
- q->saved_reg = sreg;
- q->cfa_offset = offset;
+ VEC_safe_push (queued_reg_save, heap, queued_reg_saves, e);
}
/* Output all the entries in QUEUED_REG_SAVES. */
@@ -2713,23 +2710,23 @@ static void
create_pseudo_cfg (void)
{
bool saw_barrier, switch_sections;
- dw_trace_info *ti;
+ dw_trace_info ti;
rtx insn;
unsigned i;
/* The first trace begins at the start of the function,
and begins with the CIE row state. */
trace_info = VEC_alloc (dw_trace_info, heap, 16);
- ti = VEC_quick_push (dw_trace_info, trace_info, NULL);
+ memset (&ti, 0, sizeof (ti));
+ ti.head = get_insns ();
+ ti.beg_row = cie_cfi_row;
+ ti.cfa_store = cie_cfi_row->cfa;
+ ti.cfa_temp.reg = INVALID_REGNUM;
+ VEC_quick_push (dw_trace_info, trace_info, ti);
- memset (ti, 0, sizeof (*ti));
- ti->head = get_insns ();
- ti->beg_row = cie_cfi_row;
- ti->cfa_store = cie_cfi_row->cfa;
- ti->cfa_temp.reg = INVALID_REGNUM;
if (cie_return_save)
VEC_safe_push (reg_saved_in_data, heap,
- ti->regs_saved_in_regs, cie_return_save);
+ ti.regs_saved_in_regs, *cie_return_save);
/* Walk all the insns, collecting start of trace locations. */
saw_barrier = false;
@@ -2751,11 +2748,11 @@ create_pseudo_cfg (void)
else if (save_point_p (insn)
&& (LABEL_P (insn) || !saw_barrier))
{
- ti = VEC_safe_push (dw_trace_info, heap, trace_info, NULL);
- memset (ti, 0, sizeof (*ti));
- ti->head = insn;
- ti->switch_sections = switch_sections;
- ti->id = VEC_length (dw_trace_info, trace_info) - 1;
+ memset (&ti, 0, sizeof (ti));
+ ti.head = insn;
+ ti.switch_sections = switch_sections;
+ ti.id = VEC_length (dw_trace_info, trace_info) - 1;
+ VEC_safe_push (dw_trace_info, heap, trace_info, ti);
saw_barrier = false;
switch_sections = false;
@@ -2766,19 +2763,20 @@ create_pseudo_cfg (void)
avoiding stale pointer problems due to reallocation. */
trace_index = htab_create (VEC_length (dw_trace_info, trace_info),
dw_trace_info_hash, dw_trace_info_eq, NULL);
- FOR_EACH_VEC_ELT (dw_trace_info, trace_info, i, ti)
+ dw_trace_info *tp;
+ FOR_EACH_VEC_ELT (dw_trace_info, trace_info, i, tp)
{
void **slot;
if (dump_file)
fprintf (dump_file, "Creating trace %u : start at %s %d%s\n", i,
- rtx_name[(int) GET_CODE (ti->head)], INSN_UID (ti->head),
- ti->switch_sections ? " (section switch)" : "");
+ rtx_name[(int) GET_CODE (tp->head)], INSN_UID (tp->head),
+ tp->switch_sections ? " (section switch)" : "");
- slot = htab_find_slot_with_hash (trace_index, ti,
- INSN_UID (ti->head), INSERT);
+ slot = htab_find_slot_with_hash (trace_index, tp,
+ INSN_UID (tp->head), INSERT);
gcc_assert (*slot == NULL);
- *slot = (void *) ti;
+ *slot = (void *) tp;
}
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9adb07106ba..61ea948cbb7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3484,7 +3484,7 @@ add_dwarf_attr (dw_die_ref die, dw_attr_ref attr)
if (die->die_attr == NULL)
die->die_attr = VEC_alloc (dw_attr_node, gc, 1);
- VEC_safe_push (dw_attr_node, gc, die->die_attr, attr);
+ VEC_safe_push (dw_attr_node, gc, die->die_attr, *attr);
}
static inline enum dw_val_class
@@ -8218,7 +8218,7 @@ add_pubname_string (const char *str, dw_die_ref die)
e.die = die;
e.name = xstrdup (str);
- VEC_safe_push (pubname_entry, gc, pubname_table, &e);
+ VEC_safe_push (pubname_entry, gc, pubname_table, e);
}
static void
@@ -8252,7 +8252,7 @@ add_enumerator_pubname (const char *scope_name, dw_die_ref die)
gcc_assert (scope_name);
e.name = concat (scope_name, get_AT_string (die, DW_AT_name), NULL);
e.die = die;
- VEC_safe_push (pubname_entry, gc, pubname_table, &e);
+ VEC_safe_push (pubname_entry, gc, pubname_table, e);
}
/* Add a new entry to .debug_pubtypes if appropriate. */
@@ -8295,7 +8295,7 @@ add_pubtype (tree decl, dw_die_ref die)
{
e.die = die;
e.name = concat (scope_name, name, NULL);
- VEC_safe_push (pubname_entry, gc, pubtype_table, &e);
+ VEC_safe_push (pubname_entry, gc, pubtype_table, e);
}
/* Although it might be more consistent to add the pubinfo for the
@@ -14671,7 +14671,7 @@ defer_location (tree variable, dw_die_ref die)
deferred_locations entry;
entry.variable = variable;
entry.die = die;
- VEC_safe_push (deferred_locations, gc, deferred_locations_list, &entry);
+ VEC_safe_push (deferred_locations, gc, deferred_locations_list, entry);
}
/* Helper function for tree_add_const_value_attribute. Natively encode
@@ -19870,7 +19870,7 @@ append_entry_to_tmpl_value_parm_die_table (dw_die_ref die, tree arg)
entry.arg = arg;
VEC_safe_push (die_arg_entry, gc,
tmpl_value_parm_die_table,
- &entry);
+ entry);
}
/* Return TRUE if T is an instance of generic type, FALSE
@@ -20256,7 +20256,7 @@ push_dw_line_info_entry (dw_line_info_table *table,
dw_line_info_entry e;
e.opcode = opcode;
e.val = val;
- VEC_safe_push (dw_line_info_entry, gc, table->entries, &e);
+ VEC_safe_push (dw_line_info_entry, gc, table->entries, e);
}
/* Output a label to mark the beginning of a source code line entry
@@ -20376,7 +20376,7 @@ dwarf2out_start_source_file (unsigned int lineno, const char *filename)
e.code = DW_MACINFO_start_file;
e.lineno = lineno;
e.info = ggc_strdup (filename);
- VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
+ VEC_safe_push (macinfo_entry, gc, macinfo_table, e);
}
}
@@ -20395,7 +20395,7 @@ dwarf2out_end_source_file (unsigned int lineno ATTRIBUTE_UNUSED)
e.code = DW_MACINFO_end_file;
e.lineno = lineno;
e.info = NULL;
- VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
+ VEC_safe_push (macinfo_entry, gc, macinfo_table, e);
}
}
@@ -20417,12 +20417,12 @@ dwarf2out_define (unsigned int lineno ATTRIBUTE_UNUSED,
e.code = 0;
e.lineno = 0;
e.info = NULL;
- VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
+ VEC_safe_push (macinfo_entry, gc, macinfo_table, e);
}
e.code = DW_MACINFO_define;
e.lineno = lineno;
e.info = ggc_strdup (buffer);
- VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
+ VEC_safe_push (macinfo_entry, gc, macinfo_table, e);
}
}
@@ -20444,12 +20444,12 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED,
e.code = 0;
e.lineno = 0;
e.info = NULL;
- VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
+ VEC_safe_push (macinfo_entry, gc, macinfo_table, e);
}
e.code = DW_MACINFO_undef;
e.lineno = lineno;
e.info = ggc_strdup (buffer);
- VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
+ VEC_safe_push (macinfo_entry, gc, macinfo_table, e);
}
}
@@ -20725,7 +20725,7 @@ output_macinfo (void)
switch (ref->code)
{
case DW_MACINFO_start_file:
- VEC_safe_push (macinfo_entry, gc, files, ref);
+ VEC_safe_push (macinfo_entry, gc, files, *ref);
break;
case DW_MACINFO_end_file:
if (!VEC_empty (macinfo_entry, files))
@@ -21364,7 +21364,7 @@ move_linkage_attr (dw_die_ref die)
if (ix != VEC_length (dw_attr_node, die->die_attr) - 1)
{
VEC_pop (dw_attr_node, die->die_attr);
- VEC_quick_insert (dw_attr_node, die->die_attr, ix, &linkage);
+ VEC_quick_insert (dw_attr_node, die->die_attr, ix, linkage);
}
}
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 34d85de495f..074e89ea534 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -6004,7 +6004,7 @@ curr_insn_locator (void)
{
curr_rtl_loc++;
VEC_safe_push (int, heap, locations_locators_locs, curr_rtl_loc);
- VEC_safe_push (location_t, heap, locations_locators_vals, &curr_location);
+ VEC_safe_push (location_t, heap, locations_locators_vals, curr_location);
last_location = curr_location;
}
return curr_rtl_loc;
diff --git a/gcc/except.c b/gcc/except.c
index ae5a11fdaa0..9ba7aa8f6c9 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -304,8 +304,8 @@ init_eh_for_function (void)
cfun->eh = ggc_alloc_cleared_eh_status ();
/* Make sure zero'th entries are used. */
- VEC_safe_push (eh_region, gc, cfun->eh->region_array, (eh_region) NULL);
- VEC_safe_push (eh_landing_pad, gc, cfun->eh->lp_array, (eh_landing_pad) NULL);
+ VEC_safe_push (eh_region, gc, cfun->eh->region_array, NULL);
+ VEC_safe_push (eh_landing_pad, gc, cfun->eh->lp_array, NULL);
}
/* Routines to generate the exception tree somewhat directly.
@@ -806,7 +806,7 @@ add_ehspec_entry (htab_t ehspec_hash, htab_t ttypes_hash, tree list)
if (targetm.arm_eabi_unwinder)
VEC_safe_push (tree, gc, cfun->eh->ehspec_data.arm_eabi, NULL_TREE);
else
- VEC_safe_push (uchar, gc, cfun->eh->ehspec_data.other, (uchar) 0);
+ VEC_safe_push (uchar, gc, cfun->eh->ehspec_data.other, 0);
}
return n->filter;
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 8d7aa5fe3c3..e843692e020 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1434,9 +1434,8 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
/* Initialize DOVAR. */
tmp = fold_build2_loc (input_location, MULT_EXPR, type, count, step);
tmp = fold_build2_loc (input_location, PLUS_EXPR, type, from, tmp);
- di = VEC_safe_push (dovar_init, heap, inits, NULL);
- di->var = dovar;
- di->init = tmp;
+ dovar_init e = {dovar, tmp};
+ VEC_safe_push (dovar_init, heap, inits, e);
}
if (!dovar_found)
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index e64e76da221..cb571cd6d97 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -223,7 +223,7 @@ single_def_use_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
bitmap_copy (local_lr, &lr_bb_info->in);
/* Push a marker for the leave_block callback. */
- VEC_safe_push (df_ref, heap, reg_defs_stack, (df_ref) NULL);
+ VEC_safe_push (df_ref, heap, reg_defs_stack, NULL);
process_uses (df_get_artificial_uses (bb_index), DF_REF_AT_TOP);
process_defs (df_get_artificial_defs (bb_index), DF_REF_AT_TOP);
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 5f68d5978e3..af3c34acfeb 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2520,7 +2520,7 @@ execute (void)
and record info about each one.
Also search for the programs that are to be run. */
- VEC_safe_push (const_char_p, heap, argbuf, (const_char_p)0);
+ VEC_safe_push (const_char_p, heap, argbuf, 0);
commands[0].prog = VEC_index (const_char_p, argbuf, 0); /* first command. */
commands[0].argv = VEC_address (const_char_p, argbuf);
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 767cc66edb5..a066b36c642 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -1417,7 +1417,7 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx x ATTRIBUTE_UNUSED,
{
rtx dest_addr, insn;
int bb;
- modify_pair *pair;
+ modify_pair pair;
while (GET_CODE (dest) == SUBREG
|| GET_CODE (dest) == ZERO_EXTRACT
@@ -1436,9 +1436,9 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx x ATTRIBUTE_UNUSED,
insn = (rtx) v_insn;
bb = BLOCK_FOR_INSN (insn)->index;
- pair = VEC_safe_push (modify_pair, heap, canon_modify_mem_list[bb], NULL);
- pair->dest = dest;
- pair->dest_addr = dest_addr;
+ pair.dest = dest;
+ pair.dest_addr = dest_addr;
+ VEC_safe_push (modify_pair, heap, canon_modify_mem_list[bb], pair);
}
/* Record memory modification information for INSN. We do not actually care
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 122a4a4cfbe..46a398d1a6e 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -7752,8 +7752,7 @@ output_min_issue_delay_table (automaton_t automaton)
= VEC_alloc (vect_el_t, heap, compressed_min_issue_delay_len);
for (i = 0; i < compressed_min_issue_delay_len; i++)
- VEC_quick_push (vect_el_t, compressed_min_issue_delay_vect,
- (vect_el_t) 0);
+ VEC_quick_push (vect_el_t, compressed_min_issue_delay_vect, 0);
for (i = 0; i < min_issue_delay_len; i++)
{
@@ -7845,7 +7844,7 @@ output_reserved_units_table (automaton_t automaton)
reserved_units_table = VEC_alloc (vect_el_t, heap, reserved_units_size);
for (i = 0; i < reserved_units_size; i++)
- VEC_quick_push (vect_el_t, reserved_units_table, (vect_el_t) 0);
+ VEC_quick_push (vect_el_t, reserved_units_table, 0);
for (n = 0; n < VEC_length (state_t, output_states_vect); n++)
{
state_t s = VEC_index (state_t, output_states_vect, n);
diff --git a/gcc/genextract.c b/gcc/genextract.c
index 175febeb58f..fb1428687ca 100644
--- a/gcc/genextract.c
+++ b/gcc/genextract.c
@@ -201,7 +201,7 @@ VEC_safe_set_locstr (VEC(locstr,heap) **vp, unsigned int ix, char *str)
else
{
while (ix > VEC_length (locstr, *vp))
- VEC_safe_push (locstr, heap, *vp, (locstr) NULL);
+ VEC_safe_push (locstr, heap, *vp, NULL);
VEC_safe_push (locstr, heap, *vp, str);
}
}
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index 52612794802..e0ffc8f286c 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -265,7 +265,7 @@ gen_insn (rtx insn)
{
p.op = optabs[pindex].op;
p.sort_num = (p.op << 16) | (p.m2 << 8) | p.m1;
- VEC_safe_push (pattern, heap, patterns, &p);
+ VEC_safe_push (pattern, heap, patterns, p);
return;
}
}
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 7a51e8c271c..c5a16ac52d3 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -851,7 +851,7 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
/* Not found. Create a new label and record the return statement. */
tmp_rs.label = create_artificial_label (cfun->function_end_locus);
tmp_rs.stmt = stmt;
- VEC_safe_push (return_statements_t, heap, data->return_statements, &tmp_rs);
+ VEC_safe_push (return_statements_t, heap, data->return_statements, tmp_rs);
/* Generate a goto statement and remove the return statement. */
found:
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index b66a193afee..892c561d6a3 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -182,21 +182,22 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
"__capacity") == 0);
@@ -315,7 +316,8 @@ Expression::convert_type_to_interface(Translate_context* context,
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
tree field = TYPE_FIELDS(lhs_type_tree);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
(lhs_is_empty ? "__type_descriptor" : "__methods")) == 0);
@@ -323,7 +325,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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
elt->index = field;
@@ -439,7 +441,8 @@ Expression::convert_interface_to_interface(Translate_context* context,
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
tree field = TYPE_FIELDS(lhs_type_tree);
elt->index = field;
@@ -502,7 +505,7 @@ Expression::convert_interface_to_interface(Translate_context* context,
// The second field is simply the object pointer.
- elt = VEC_quick_push(constructor_elt, init, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
elt->index = field;
@@ -9959,20 +9962,21 @@ Array_index_expression::do_get_tree(Translate_context* context)
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0);
elt->index = field;
@@ -11355,7 +11359,8 @@ Struct_construction_expression::do_get_tree(Translate_context* context)
if (val == error_mark_node || TREE_TYPE(val) == error_mark_node)
return error_mark_node;
- constructor_elt* elt = VEC_quick_push(constructor_elt, elts, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, elts, empty);
elt->index = field;
elt->value = val;
if (!TREE_CONSTANT(val))
@@ -11583,7 +11588,8 @@ Array_construction_expression::get_constructor_tree(Translate_context* context,
{
if (this->indexes_ != NULL)
go_assert(pi != this->indexes_->end());
- constructor_elt* elt = VEC_quick_push(constructor_elt, values, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, values, empty);
if (this->indexes_ == NULL)
elt->index = size_int(i);
@@ -11793,7 +11799,8 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
if (constructor_type == error_mark_node)
return error_mark_node;
VEC(constructor_elt,gc)* vec = VEC_alloc(constructor_elt, gc, 1);
- constructor_elt* elt = VEC_quick_push(constructor_elt, vec, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, vec, empty);
elt->index = size_int(0);
Gogo* gogo = context->gogo();
Btype* btype = element_type->get_backend(gogo);
@@ -11886,19 +11893,20 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),"__capacity") == 0);
elt->index = field;
@@ -12102,7 +12110,8 @@ Map_construction_expression::do_get_tree(Translate_context* context)
VEC(constructor_elt,gc)* one = VEC_alloc(constructor_elt, gc, 2);
- constructor_elt* elt = VEC_quick_push(constructor_elt, one, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, one, empty);
elt->index = key_field;
tree val_tree = (*pv)->get_tree(context);
elt->value = Expression::convert_for_assignment(context, key_type,
@@ -12115,7 +12124,7 @@ Map_construction_expression::do_get_tree(Translate_context* context)
++pv;
- elt = VEC_quick_push(constructor_elt, one, NULL);
+ elt = VEC_quick_push(constructor_elt, one, empty);
elt->index = val_field;
val_tree = (*pv)->get_tree(context);
elt->value = Expression::convert_for_assignment(context, val_type,
@@ -12126,7 +12135,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, NULL);
+ elt = VEC_quick_push(constructor_elt, values, 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 c933d937596..9a181a344ad 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -354,7 +354,8 @@ Gogo::register_gc_vars(const std::vector<Named_object*>& var_gc,
{
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
tree field = TYPE_FIELDS(root_type);
elt->index = field;
Bvariable* bvar = (*p)->get_backend_variable(this, NULL);
@@ -362,12 +363,12 @@ Gogo::register_gc_vars(const std::vector<Named_object*>& var_gc,
go_assert(TREE_CODE(decl) == VAR_DECL);
elt->value = build_fold_addr_expr(decl);
- elt = VEC_quick_push(constructor_elt, init, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
elt->index = field;
elt->value = DECL_SIZE_UNIT(decl);
- elt = VEC_quick_push(constructor_elt, roots_init, NULL);
+ elt = VEC_quick_push(constructor_elt, roots_init, empty);
elt->index = size_int(i);
elt->value = build_constructor(root_type, init);
}
@@ -376,17 +377,18 @@ Gogo::register_gc_vars(const std::vector<Named_object*>& var_gc,
VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
elt->index = field;
elt->value = size_zero_node;
- elt = VEC_quick_push(constructor_elt, roots_init, NULL);
+ elt = VEC_quick_push(constructor_elt, roots_init, empty);
elt->index = size_int(i);
elt->value = build_constructor(root_type, init);
@@ -394,12 +396,12 @@ Gogo::register_gc_vars(const std::vector<Named_object*>& var_gc,
VEC(constructor_elt,gc)* root_list_init = VEC_alloc(constructor_elt, gc, 2);
- elt = VEC_quick_push(constructor_elt, root_list_init, NULL);
+ elt = VEC_quick_push(constructor_elt, root_list_init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, root_list_init, empty);
field = DECL_CHAIN(field);
elt->index = field;
elt->value = build_constructor(array_type, roots_init);
@@ -2029,7 +2031,8 @@ Gogo::go_string_constant_tree(const std::string& val)
VEC(constructor_elt, gc)* init = VEC_alloc(constructor_elt, gc, 2);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
tree field = TYPE_FIELDS(string_type);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__data") == 0);
elt->index = field;
@@ -2037,7 +2040,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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__length") == 0);
elt->index = field;
@@ -2089,7 +2092,8 @@ Gogo::slice_constructor(tree slice_type_tree, tree values, tree count,
tree field = TYPE_FIELDS(slice_type_tree);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
- constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
elt->index = field;
go_assert(TYPE_MAIN_VARIANT(TREE_TYPE(field))
== TYPE_MAIN_VARIANT(TREE_TYPE(values)));
@@ -2104,13 +2108,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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, 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, NULL);
+ elt = VEC_quick_push(constructor_elt, init, empty);
elt->index = field;
elt->value = fold_convert(TREE_TYPE(field), capacity);
@@ -2170,7 +2174,8 @@ Gogo::interface_method_table_for_type(const Interface_type* interface,
count + 1);
// The first element is the type descriptor.
- constructor_elt* elt = VEC_quick_push(constructor_elt, pointers, NULL);
+ constructor_elt empty = {NULL, NULL};
+ constructor_elt* elt = VEC_quick_push(constructor_elt, pointers, empty);
elt->index = size_zero_node;
Type* td_type;
if (!is_pointer)
@@ -2204,7 +2209,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, NULL);
+ elt = VEC_quick_push(constructor_elt, pointers, empty);
elt->index = size_int(i);
elt->value = fold_convert(const_ptr_type_node, fndecl);
}
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index ded38f5af1a..3a7b9101db9 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1249,7 +1249,7 @@ build_sese_conditions_before (struct dom_walk_data *dw_data,
if (e->flags & EDGE_TRUE_VALUE)
VEC_safe_push (gimple, heap, *cases, stmt);
else
- VEC_safe_push (gimple, heap, *cases, (gimple) NULL);
+ VEC_safe_push (gimple, heap, *cases, NULL);
}
gbb = gbb_from_bb (bb);
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 97ae376a658..613b606d1db 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -266,7 +266,7 @@ add_condition (struct inline_summary *summary, int operand_num,
new_cond.agg_contents = agg_contents;
new_cond.by_ref = by_ref;
new_cond.offset = offset;
- VEC_safe_push (condition, gc, summary->conds, &new_cond);
+ VEC_safe_push (condition, gc, summary->conds, new_cond);
return single_cond_predicate (i + predicate_first_dynamic_condition);
}
@@ -688,7 +688,7 @@ account_size_time (struct inline_summary *summary, int size, int time,
new_entry.size = size;
new_entry.time = time;
new_entry.predicate = *pred;
- VEC_safe_push (size_time_entry, gc, summary->entry, &new_entry);
+ VEC_safe_push (size_time_entry, gc, summary->entry, new_entry);
}
else
{
@@ -3579,7 +3579,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
c.by_ref = bp_unpack_value (&bp, 1);
if (c.agg_contents)
c.offset = streamer_read_uhwi (&ib);
- VEC_safe_push (condition, gc, info->conds, &c);
+ VEC_safe_push (condition, gc, info->conds, c);
}
count2 = streamer_read_uhwi (&ib);
gcc_assert (!info->entry);
@@ -3591,7 +3591,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
e.time = streamer_read_uhwi (&ib);
e.predicate = read_predicate (&ib);
- VEC_safe_push (size_time_entry, gc, info->entry, &e);
+ VEC_safe_push (size_time_entry, gc, info->entry, e);
}
p = read_predicate (&ib);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 8ee871cfe62..9729145b7a1 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1342,11 +1342,10 @@ determine_known_aggregate_parts (gimple call, tree arg,
{
if (list->constant)
{
- struct ipa_agg_jf_item *item;
- item = VEC_quick_push (ipa_agg_jf_item_t,
- jfunc->agg.items, NULL);
- item->offset = list->offset - arg_offset;
- item->value = list->constant;
+ struct ipa_agg_jf_item item;
+ item.offset = list->offset - arg_offset;
+ item.value = list->constant;
+ VEC_quick_push (ipa_agg_jf_item_t, jfunc->agg.items, item);
}
list = list->next;
}
@@ -3023,45 +3022,44 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
if (n->remove_param)
removals++;
else
- VEC_quick_push (ipa_parm_adjustment_t, tmp, n);
+ VEC_quick_push (ipa_parm_adjustment_t, tmp, *n);
}
adjustments = VEC_alloc (ipa_parm_adjustment_t, heap, outlen + removals);
for (i = 0; i < outlen; i++)
{
- struct ipa_parm_adjustment *r;
+ struct ipa_parm_adjustment r;
struct ipa_parm_adjustment *out = &VEC_index (ipa_parm_adjustment_t,
outer, i);
struct ipa_parm_adjustment *in = &VEC_index (ipa_parm_adjustment_t, tmp,
out->base_index);
+ memset (&r, 0, sizeof (r));
gcc_assert (!in->remove_param);
if (out->remove_param)
{
if (!index_in_adjustments_multiple_times_p (in->base_index, tmp))
{
- r = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL);
- memset (r, 0, sizeof (*r));
- r->remove_param = true;
+ r.remove_param = true;
+ VEC_quick_push (ipa_parm_adjustment_t, adjustments, r);
}
continue;
}
- r = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL);
- memset (r, 0, sizeof (*r));
- r->base_index = in->base_index;
- r->type = out->type;
+ r.base_index = in->base_index;
+ r.type = out->type;
/* FIXME: Create nonlocal value too. */
if (in->copy_param && out->copy_param)
- r->copy_param = true;
+ r.copy_param = true;
else if (in->copy_param)
- r->offset = out->offset;
+ r.offset = out->offset;
else if (out->copy_param)
- r->offset = in->offset;
+ r.offset = in->offset;
else
- r->offset = in->offset + out->offset;
+ r.offset = in->offset + out->offset;
+ VEC_quick_push (ipa_parm_adjustment_t, adjustments, r);
}
for (i = 0; i < inlen; i++)
@@ -3070,7 +3068,7 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
inner, i);
if (n->remove_param)
- VEC_quick_push (ipa_parm_adjustment_t, adjustments, n);
+ VEC_quick_push (ipa_parm_adjustment_t, adjustments, *n);
}
VEC_free (ipa_parm_adjustment_t, heap, tmp);
@@ -3238,11 +3236,10 @@ ipa_read_jump_function (struct lto_input_block *ib,
}
for (i = 0; i < count; i++)
{
- struct ipa_agg_jf_item *item = VEC_quick_push (ipa_agg_jf_item_t,
- jump_func->agg.items, NULL);
-
- item->offset = streamer_read_uhwi (ib);
- item->value = stream_read_tree (ib, data_in);
+ struct ipa_agg_jf_item item;
+ item.offset = streamer_read_uhwi (ib);
+ item.value = stream_read_tree (ib, data_in);
+ VEC_quick_push (ipa_agg_jf_item_t, jump_func->agg.items, item);
}
}
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index be1d2cce230..e1d1c4928e6 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -912,7 +912,7 @@ find_split_points (int overall_time, int overall_size)
first.set_ssa_names = 0;
first.used_ssa_names = 0;
first.bbs_visited = 0;
- VEC_safe_push (stack_entry, heap, stack, &first);
+ VEC_safe_push (stack_entry, heap, stack, first);
ENTRY_BLOCK_PTR->aux = (void *)(intptr_t)-1;
while (!VEC_empty (stack_entry, stack))
@@ -994,7 +994,7 @@ find_split_points (int overall_time, int overall_size)
new_entry.non_ssa_vars = BITMAP_ALLOC (NULL);
new_entry.can_split = true;
bitmap_set_bit (new_entry.bbs_visited, dest->index);
- VEC_safe_push (stack_entry, heap, stack, &new_entry);
+ VEC_safe_push (stack_entry, heap, stack, new_entry);
dest->aux = (void *)(intptr_t)VEC_length (stack_entry, stack);
}
/* Back edge found, record the earliest point. */
diff --git a/gcc/java/class.c b/gcc/java/class.c
index f806cea1414..a89b83183b6 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -2198,9 +2198,10 @@ make_class_data (tree type)
for (i = 0; i < count; i++)
{
- constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
- elt->index = build_int_cst (sizetype, i);
- elt->value = build_int_cstu (byte_type_node, data[i]);
+ constructor_elt elt;
+ elt.index = build_int_cst (sizetype, i);
+ elt.value = build_int_cstu (byte_type_node, data[i]);
+ VEC_quick_push (constructor_elt, v, elt);
}
DECL_INITIAL (array) = build_constructor (type, v);
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 0429c02ca34..8041cdd99c4 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2296,14 +2296,13 @@ get_symbol_table_index (tree t, tree special,
{
method_entry *e;
unsigned i;
+ method_entry elem = {t, special};
FOR_EACH_VEC_ELT (method_entry, *symbol_table, i, e)
if (t == e->method && special == e->special)
goto done;
- e = VEC_safe_push (method_entry, gc, *symbol_table, NULL);
- e->method = t;
- e->special = special;
+ VEC_safe_push (method_entry, gc, *symbol_table, elem);
done:
return i + 1;
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 6223d1a6a57..24222883da4 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -114,7 +114,7 @@ lto_symtab_encoder_encode (lto_symtab_encoder_t encoder,
if (!slot)
slot = pointer_map_insert (encoder->map, node);
*slot = (void *) (intptr_t) (ref + 1);
- VEC_safe_push (lto_encoder_entry, heap, encoder->nodes, &entry);
+ VEC_safe_push (lto_encoder_entry, heap, encoder->nodes, entry);
}
else
ref = (size_t) *slot - 1;
diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index 4f47a579087..cf899d379bd 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -1068,7 +1068,7 @@ objc_v2_get_class_reference (tree ident)
decl = build_v2_class_reference_decl (ident);
e.ident = ident;
e.data = decl;
- VEC_safe_push (ident_data_tuple, gc, classrefs, &e);
+ VEC_safe_push (ident_data_tuple, gc, classrefs, e);
return decl;
}
@@ -1233,7 +1233,7 @@ build_v2_selector_messenger_reference (tree sel_name, tree message_func_decl)
e.func = message_func_decl;
e.selname = sel_name;
e.refdecl = decl;
- VEC_safe_push (msgref_entry, gc, msgrefs, &e);
+ VEC_safe_push (msgref_entry, gc, msgrefs, e);
return decl;
}
@@ -1290,7 +1290,7 @@ objc_v2_get_protocol_reference (tree ident)
decl = build_v2_protocollist_ref_decl (ident);
e.id = ident;
e.refdecl = decl;
- VEC_safe_push (prot_list_entry, gc, protrefs, &e);
+ VEC_safe_push (prot_list_entry, gc, protrefs, e);
return decl;
}
@@ -1476,7 +1476,7 @@ next_runtime_abi_02_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
decl = build_v2_superclass_ref_decl (id, inst_meth);
e.ident = id;
e.data = decl;
- VEC_safe_push (ident_data_tuple, gc, list, &e);
+ VEC_safe_push (ident_data_tuple, gc, list, e);
return decl;
}
@@ -2126,7 +2126,7 @@ objc_add_to_protocol_list (tree protocol_interface_decl, tree protocol_decl)
protlist = VEC_alloc (prot_list_entry, gc, 32);
e.id = protocol_interface_decl;
e.refdecl = protocol_decl;
- VEC_safe_push (prot_list_entry, gc, protlist, &e);
+ VEC_safe_push (prot_list_entry, gc, protlist, e);
}
/* Build the __protocol_list section table containing address of all
@@ -2806,7 +2806,7 @@ ivar_offset_ref (tree class_name, tree field_decl)
e.decl = decl;
e.offset = byte_position (field_decl);
- VEC_safe_push (ivarref_entry, gc, ivar_offset_refs, &e);
+ VEC_safe_push (ivarref_entry, gc, ivar_offset_refs, e);
return decl;
}
@@ -3082,7 +3082,7 @@ objc_v2_add_to_ehtype_list (tree name)
/* Not found, or new list. */
e.ident = name;
e.data = NULL_TREE;
- VEC_safe_push (ident_data_tuple, gc, ehtype_list, &e);
+ VEC_safe_push (ident_data_tuple, gc, ehtype_list, e);
}
static void
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 354bce07dc2..e024537fa0f 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1144,12 +1144,8 @@ set_option (struct gcc_options *opts, struct gcc_options *opts_set,
{
VEC(cl_deferred_option,heap) *vec
= (VEC(cl_deferred_option,heap) *) *(void **) flag_var;
- cl_deferred_option *p;
-
- p = VEC_safe_push (cl_deferred_option, heap, vec, NULL);
- p->opt_index = opt_index;
- p->arg = arg;
- p->value = value;
+ cl_deferred_option p = {opt_index, arg, value};
+ VEC_safe_push (cl_deferred_option, heap, vec, p);
*(void **) flag_var = vec;
if (set_flag_var)
*(void **) set_flag_var = vec;
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index 71ecf537642..30c2fb69484 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -684,11 +684,8 @@ validate_const_int (const char *string)
static void
record_iterator_use (struct mapping *iterator, void *ptr)
{
- struct iterator_use *iuse;
-
- iuse = VEC_safe_push (iterator_use, heap, iterator_uses, NULL);
- iuse->iterator = iterator;
- iuse->ptr = ptr;
+ struct iterator_use iuse = {iterator, ptr};
+ VEC_safe_push (iterator_use, heap, iterator_uses, iuse);
}
/* Record that PTR uses attribute VALUE, which must match a built-in
@@ -698,12 +695,8 @@ static void
record_attribute_use (struct iterator_group *group, void *ptr,
const char *value)
{
- struct attribute_use *ause;
-
- ause = VEC_safe_push (attribute_use, heap, attribute_uses, NULL);
- ause->group = group;
- ause->value = value;
- ause->ptr = ptr;
+ struct attribute_use ause = {group, value, ptr};
+ VEC_safe_push (attribute_use, heap, attribute_uses, ause);
}
/* Interpret NAME as either a built-in value, iterator or attribute
diff --git a/gcc/ree.c b/gcc/ree.c
index 1d0f1949b80..99ecd578097 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -816,11 +816,8 @@ add_removable_extension (const_rtx expr, rtx insn,
/* Then add the candidate to the list and insert the reaching definitions
into the definition map. */
- cand = VEC_safe_push (ext_cand, heap, *insn_list, NULL);
- cand->expr = expr;
- cand->code = code;
- cand->mode = mode;
- cand->insn = insn;
+ ext_cand e = {expr, code, mode, insn};
+ VEC_safe_push (ext_cand, heap, *insn_list, e);
idx = VEC_length (ext_cand, *insn_list);
for (def = defs; def; def = def->next)
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 77c7ba0911a..1bcdfad9377 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -659,15 +659,12 @@ grow_reg_equivs (void)
int old_size = VEC_length (reg_equivs_t, reg_equivs);
int max_regno = max_reg_num ();
int i;
+ reg_equivs_t ze;
+ memset (&ze, 0, sizeof (reg_equivs_t));
VEC_reserve (reg_equivs_t, gc, reg_equivs, max_regno);
for (i = old_size; i < max_regno; i++)
- {
- VEC_quick_insert (reg_equivs_t, reg_equivs, i, 0);
- memset (&VEC_index (reg_equivs_t, reg_equivs, i), 0,
- sizeof (reg_equivs_t));
- }
-
+ VEC_quick_insert (reg_equivs_t, reg_equivs, i, ze);
}
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 1f1095ecfed..2a7a17066f6 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1542,7 +1542,7 @@ insert_in_history_vect (VEC (expr_history_def, heap) **pvect,
vinsn_attach (old_expr_vinsn);
vinsn_attach (new_expr_vinsn);
- VEC_safe_insert (expr_history_def, heap, vect, ind, &temp);
+ VEC_safe_insert (expr_history_def, heap, vect, ind, temp);
*pvect = vect;
}
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index be020dab809..c879548483b 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -374,7 +374,7 @@ gen_conditions_for_domain (tree arg, inp_domain domain,
{
/* Now push a separator. */
if (domain.has_lb)
- VEC_quick_push (gimple, conds, (gimple)NULL);
+ VEC_quick_push (gimple, conds, NULL);
gen_one_condition (arg, domain.ub,
(domain.is_ub_inclusive
@@ -496,7 +496,7 @@ gen_conditions_for_pow_int_base (tree base, tree expn,
type is integer. */
/* Push a separator. */
- VEC_quick_push (gimple, conds, (gimple)NULL);
+ VEC_quick_push (gimple, conds, NULL);
temp = create_tmp_var (int_type, "DCE_COND1");
cst0 = build_int_cst (int_type, 0);
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 38327b0d2c3..0f68fdf4020 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -4300,7 +4300,7 @@ static bool
get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
{
bool clobbers_memory = false;
- data_ref_loc *ref;
+ data_ref_loc ref;
tree *op0, *op1;
enum gimple_code stmt_code = gimple_code (stmt);
@@ -4329,9 +4329,9 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
&& (base = get_base_address (*op1))
&& TREE_CODE (base) != SSA_NAME))
{
- ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
- ref->pos = op1;
- ref->is_read = true;
+ ref.pos = op1;
+ ref.is_read = true;
+ VEC_safe_push (data_ref_loc, heap, *references, ref);
}
}
else if (stmt_code == GIMPLE_CALL)
@@ -4347,9 +4347,9 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
if (DECL_P (*op1)
|| (REFERENCE_CLASS_P (*op1) && get_base_address (*op1)))
{
- ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
- ref->pos = op1;
- ref->is_read = true;
+ ref.pos = op1;
+ ref.is_read = true;
+ VEC_safe_push (data_ref_loc, heap, *references, ref);
}
}
}
@@ -4360,9 +4360,9 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
&& (DECL_P (*op0)
|| (REFERENCE_CLASS_P (*op0) && get_base_address (*op0))))
{
- ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
- ref->pos = op0;
- ref->is_read = false;
+ ref.pos = op0;
+ ref.is_read = false;
+ VEC_safe_push (data_ref_loc, heap, *references, ref);
}
return clobbers_memory;
}
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index f8f10a42276..423923fb66a 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -729,7 +729,7 @@ dump_enumerated_decls_push (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
nt.t = *tp;
nt.num = VEC_length (numbered_tree, *list);
- VEC_safe_push (numbered_tree, heap, *list, &nt);
+ VEC_safe_push (numbered_tree, heap, *list, nt);
*walk_subtrees = 0;
return NULL_TREE;
}
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 1276cbea6af..2756ed21374 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -127,7 +127,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
loc.where = where;
loc.map = map;
- VEC_safe_push (loc_map_pair, heap, loc_vec, &loc);
+ VEC_safe_push (loc_map_pair, heap, loc_vec, loc);
/* WHERE is the location of a token inside the expansion of a
macro. MAP is the map holding the locations of that macro
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index b30469c8e59..88e77dace60 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -149,29 +149,29 @@ tree
default_emutls_var_init (tree to, tree decl, tree proxy)
{
VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 4);
- constructor_elt *elt;
+ constructor_elt elt;
tree type = TREE_TYPE (to);
tree field = TYPE_FIELDS (type);
- elt = VEC_quick_push (constructor_elt, v, NULL);
- elt->index = field;
- elt->value = fold_convert (TREE_TYPE (field), DECL_SIZE_UNIT (decl));
+ elt.index = field;
+ elt.value = fold_convert (TREE_TYPE (field), DECL_SIZE_UNIT (decl));
+ VEC_quick_push (constructor_elt, v, elt);
- elt = VEC_quick_push (constructor_elt, v, NULL);
field = DECL_CHAIN (field);
- elt->index = field;
- elt->value = build_int_cst (TREE_TYPE (field),
- DECL_ALIGN_UNIT (decl));
+ elt.index = field;
+ elt.value = build_int_cst (TREE_TYPE (field),
+ DECL_ALIGN_UNIT (decl));
+ VEC_quick_push (constructor_elt, v, elt);
- elt = VEC_quick_push (constructor_elt, v, NULL);
field = DECL_CHAIN (field);
- elt->index = field;
- elt->value = null_pointer_node;
+ elt.index = field;
+ elt.value = null_pointer_node;
+ VEC_quick_push (constructor_elt, v, elt);
- elt = VEC_quick_push (constructor_elt, v, NULL);
field = DECL_CHAIN (field);
- elt->index = field;
- elt->value = proxy;
+ elt.index = field;
+ elt.value = proxy;
+ VEC_quick_push (constructor_elt, v, elt);
return build_constructor (type, v);
}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index aafaa15a805..ef3f5f99ed6 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3999,7 +3999,7 @@ splice_all_param_accesses (VEC (access_p, heap) **representatives)
result = UNUSED_PARAMS;
}
else
- VEC_quick_push (access_p, *representatives, (access_p) NULL);
+ VEC_quick_push (access_p, *representatives, NULL);
}
if (result == NO_GOOD_ACCESS)
@@ -4050,36 +4050,35 @@ turn_representatives_into_adjustments (VEC (access_p, heap) *representatives,
if (!repr || no_accesses_p (repr))
{
- struct ipa_parm_adjustment *adj;
+ struct ipa_parm_adjustment adj;
- adj = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL);
- memset (adj, 0, sizeof (*adj));
- adj->base_index = get_param_index (parm, parms);
- adj->base = parm;
+ memset (&adj, 0, sizeof (adj));
+ adj.base_index = get_param_index (parm, parms);
+ adj.base = parm;
if (!repr)
- adj->copy_param = 1;
+ adj.copy_param = 1;
else
- adj->remove_param = 1;
+ adj.remove_param = 1;
+ VEC_quick_push (ipa_parm_adjustment_t, adjustments, adj);
}
else
{
- struct ipa_parm_adjustment *adj;
+ struct ipa_parm_adjustment adj;
int index = get_param_index (parm, parms);
for (; repr; repr = repr->next_grp)
{
- adj = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL);
- memset (adj, 0, sizeof (*adj));
+ memset (&adj, 0, sizeof (adj));
gcc_assert (repr->base == parm);
- adj->base_index = index;
- adj->base = repr->base;
- adj->type = repr->type;
- adj->alias_ptr_type = reference_alias_ptr_type (repr->expr);
- adj->offset = repr->offset;
- adj->by_ref = (POINTER_TYPE_P (TREE_TYPE (repr->base))
- && (repr->grp_maybe_modified
- || repr->grp_not_necessarilly_dereferenced));
-
+ adj.base_index = index;
+ adj.base = repr->base;
+ adj.type = repr->type;
+ adj.alias_ptr_type = reference_alias_ptr_type (repr->expr);
+ adj.offset = repr->offset;
+ adj.by_ref = (POINTER_TYPE_P (TREE_TYPE (repr->base))
+ && (repr->grp_maybe_modified
+ || repr->grp_not_necessarilly_dereferenced));
+ VEC_quick_push (ipa_parm_adjustment_t, adjustments, adj);
}
}
}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 4a89df25fbb..9065006c55e 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1231,7 +1231,7 @@ build_and_record_new_cond (enum tree_code code,
cond->ops.binary.opnd1 = op1;
c.value = boolean_true_node;
- VEC_safe_push (cond_equivalence, heap, *p, &c);
+ VEC_safe_push (cond_equivalence, heap, *p, c);
}
/* Record that COND is true and INVERTED is false into the edge information
@@ -1338,7 +1338,7 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted)
two slots. */
initialize_expr_from_cond (cond, &c.cond);
c.value = boolean_true_node;
- VEC_safe_push (cond_equivalence, heap, edge_info->cond_equivalences, &c);
+ VEC_safe_push (cond_equivalence, heap, edge_info->cond_equivalences, c);
/* It is possible for INVERTED to be the negation of a comparison,
and not a valid RHS or GIMPLE_COND condition. This happens because
@@ -1347,7 +1347,7 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted)
obey the trichotomy law. */
initialize_expr_from_cond (inverted, &c.cond);
c.value = boolean_false_node;
- VEC_safe_push (cond_equivalence, heap, edge_info->cond_equivalences, &c);
+ VEC_safe_push (cond_equivalence, heap, edge_info->cond_equivalences, c);
}
/* A helper function for record_const_or_copy and record_equality.
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 9e217b5f0a4..64f538e344f 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4773,7 +4773,7 @@ init_pre (bool do_fre)
next_expression_id = 1;
expressions = NULL;
- VEC_safe_push (pre_expr, heap, expressions, (pre_expr)NULL);
+ VEC_safe_push (pre_expr, heap, expressions, NULL);
value_expressions = VEC_alloc (bitmap, heap, get_max_value_id () + 1);
VEC_safe_grow_cleared (bitmap, heap, value_expressions,
get_max_value_id() + 1);
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 2b1298d1402..960e2c3c389 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1344,7 +1344,7 @@ undistribute_ops_list (enum tree_code opcode,
c.cnt = 1;
c.id = next_oecount_id++;
c.op = oe1->op;
- VEC_safe_push (oecount, heap, cvec, &c);
+ VEC_safe_push (oecount, heap, cvec, c);
idx = VEC_length (oecount, cvec) + 41;
slot = htab_find_slot (ctable, (void *)idx, INSERT);
if (!*slot)
@@ -3118,7 +3118,7 @@ attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops)
rfnew.rank = oe->rank;
rfnew.count = oe->count;
rfnew.repr = NULL_TREE;
- VEC_safe_push (repeat_factor, heap, repeat_factor_vec, &rfnew);
+ VEC_safe_push (repeat_factor, heap, repeat_factor_vec, rfnew);
}
}
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 5cc88ae2242..9a370e8ab3c 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -591,21 +591,21 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
temp.op1 = TMR_STEP (ref);
temp.op2 = TMR_OFFSET (ref);
temp.off = -1;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
memset (&temp, 0, sizeof (temp));
temp.type = NULL_TREE;
temp.opcode = ERROR_MARK;
temp.op0 = TMR_INDEX2 (ref);
temp.off = -1;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
memset (&temp, 0, sizeof (temp));
temp.type = NULL_TREE;
temp.opcode = TREE_CODE (TMR_BASE (ref));
temp.op0 = TMR_BASE (ref);
temp.off = -1;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
return;
}
@@ -700,7 +700,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
temp.opcode = MEM_REF;
temp.op0 = build_int_cst (build_pointer_type (TREE_TYPE (ref)), 0);
temp.off = 0;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
temp.opcode = ADDR_EXPR;
temp.op0 = build_fold_addr_expr (ref);
temp.type = TREE_TYPE (temp.op0);
@@ -739,7 +739,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
default:
gcc_unreachable ();
}
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
if (REFERENCE_CLASS_P (ref)
|| TREE_CODE (ref) == MODIFY_EXPR
@@ -949,7 +949,7 @@ copy_reference_ops_from_call (gimple call,
temp.type = TREE_TYPE (lhs);
temp.op0 = lhs;
temp.off = -1;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
}
/* Copy the type, opcode, function being called and static chain. */
@@ -959,7 +959,7 @@ copy_reference_ops_from_call (gimple call,
temp.op0 = gimple_call_fn (call);
temp.op1 = gimple_call_chain (call);
temp.off = -1;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ VEC_safe_push (vn_reference_op_s, heap, *result, temp);
/* Copy the call arguments. As they can be references as well,
just chain them together. */
@@ -3766,7 +3766,7 @@ start_over:
{
/* Recurse by pushing the current use walking state on
the stack and starting over. */
- VEC_safe_push(ssa_op_iter, heap, itervec, &iter);
+ VEC_safe_push(ssa_op_iter, heap, itervec, iter);
VEC_safe_push(tree, heap, namevec, name);
name = use;
goto start_over;
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 4969edc4b5b..688b0688b82 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -826,7 +826,7 @@ constraint_expr_less (struct constraint_expr a, struct constraint_expr b)
arbitrary, but consistent, in order to give them an ordering. */
static bool
-constraint_less (const constraint_t a, const constraint_t b)
+constraint_less (const constraint_t &a, const constraint_t &b)
{
if (constraint_expr_less (a->lhs, b->lhs))
return true;
@@ -2793,12 +2793,12 @@ get_constraint_for_ssa_var (tree t, VEC(ce_s, heap) **results, bool address_p)
for (; vi; vi = vi->next)
{
cexpr.var = vi->id;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, heap, *results, cexpr);
}
return;
}
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, heap, *results, cexpr);
}
/* Process constraint T, performing various simplifications and then
@@ -2945,7 +2945,7 @@ get_constraint_for_ptr_offset (tree ptr, tree offset,
c2.type = ADDRESSOF;
c2.offset = 0;
if (c2.var != c.var)
- VEC_safe_push (ce_s, heap, *results, &c2);
+ VEC_safe_push (ce_s, heap, *results, c2);
temp = temp->next;
}
while (temp);
@@ -2980,7 +2980,7 @@ get_constraint_for_ptr_offset (tree ptr, tree offset,
c2.var = temp->next->id;
c2.type = ADDRESSOF;
c2.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &c2);
+ VEC_safe_push (ce_s, heap, *results, c2);
}
c.var = temp->id;
c.offset = 0;
@@ -3024,7 +3024,7 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
temp.offset = 0;
temp.var = integer_id;
temp.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, heap, *results, temp);
return;
}
@@ -3046,7 +3046,7 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
temp.offset = 0;
temp.var = anything_id;
temp.type = ADDRESSOF;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, heap, *results, temp);
return;
}
}
@@ -3087,7 +3087,7 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
bitpos, bitmaxsize))
{
cexpr.var = curr->id;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, heap, *results, cexpr);
if (address_p)
break;
}
@@ -3102,7 +3102,7 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
while (curr->next != NULL)
curr = curr->next;
cexpr.var = curr->id;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, heap, *results, cexpr);
}
else if (VEC_length (ce_s, *results) == 0)
/* Assert that we found *some* field there. The user couldn't be
@@ -3115,7 +3115,7 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
cexpr.type = SCALAR;
cexpr.var = anything_id;
cexpr.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, heap, *results, cexpr);
}
}
else if (bitmaxsize == 0)
@@ -3239,7 +3239,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
temp.var = nonlocal_id;
temp.type = ADDRESSOF;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, heap, *results, temp);
return;
}
@@ -3249,7 +3249,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
temp.var = readonly_id;
temp.type = SCALAR;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, heap, *results, temp);
return;
}
@@ -3310,7 +3310,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
if (curr->offset - vi->offset < size)
{
cs.var = curr->id;
- VEC_safe_push (ce_s, heap, *results, &cs);
+ VEC_safe_push (ce_s, heap, *results, cs);
}
else
break;
@@ -3352,7 +3352,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
unsigned j;
get_constraint_for_1 (val, &tmp, address_p, lhs_p);
FOR_EACH_VEC_ELT (ce_s, tmp, j, rhsp)
- VEC_safe_push (ce_s, heap, *results, rhsp);
+ VEC_safe_push (ce_s, heap, *results, *rhsp);
VEC_truncate (ce_s, tmp, 0);
}
VEC_free (ce_s, heap, tmp);
@@ -3376,7 +3376,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
temp.type = ADDRESSOF;
temp.var = nonlocal_id;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, heap, *results, temp);
return;
}
default:;
@@ -3386,7 +3386,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
temp.type = ADDRESSOF;
temp.var = anything_id;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, heap, *results, temp);
}
/* Given a gimple tree T, return the constraint expression vector for it. */
@@ -3793,7 +3793,7 @@ handle_rhs_call (gimple stmt, VEC(ce_s, heap) **results)
rhsc.var = get_call_use_vi (stmt)->id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, heap, *results, rhsc);
}
/* The static chain escapes as well. */
@@ -3820,7 +3820,7 @@ handle_rhs_call (gimple stmt, VEC(ce_s, heap) **results)
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, heap, *results, rhsc);
}
/* For non-IPA mode, generate constraints necessary for a call
@@ -3845,7 +3845,7 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, heap) *rhsc,
tmpc.var = escaped_id;
tmpc.offset = 0;
tmpc.type = SCALAR;
- VEC_safe_push (ce_s, heap, lhsc, &tmpc);
+ VEC_safe_push (ce_s, heap, lhsc, tmpc);
}
/* If the call returns an argument unmodified override the rhs
@@ -3880,7 +3880,7 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, heap) *rhsc,
tmpc.var = vi->id;
tmpc.offset = 0;
tmpc.type = ADDRESSOF;
- VEC_safe_push (ce_s, heap, rhsc, &tmpc);
+ VEC_safe_push (ce_s, heap, rhsc, tmpc);
process_all_all_constraints (lhsc, rhsc);
VEC_free (ce_s, heap, rhsc);
}
@@ -3909,7 +3909,7 @@ handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
rhsc.var = uses->id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, heap, *results, rhsc);
}
/* May return arguments. */
@@ -3921,7 +3921,7 @@ handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
struct constraint_expr *argp;
get_constraint_for_rhs (arg, &argc);
FOR_EACH_VEC_ELT (ce_s, argc, i, argp)
- VEC_safe_push (ce_s, heap, *results, argp);
+ VEC_safe_push (ce_s, heap, *results, *argp);
VEC_free(ce_s, heap, argc);
}
@@ -3929,7 +3929,7 @@ handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = ADDRESSOF;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, heap, *results, rhsc);
}
/* For non-IPA mode, generate constraints necessary for a call to a
@@ -3971,12 +3971,12 @@ handle_pure_call (gimple stmt, VEC(ce_s, heap) **results)
rhsc.var = uses->id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, heap, *results, rhsc);
}
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, heap, *results, rhsc);
}
@@ -4412,7 +4412,7 @@ find_func_aliases_for_call (gimple t)
&& DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
{
VEC(ce_s, heap) *tem = NULL;
- VEC_safe_push (ce_s, heap, tem, &rhs);
+ VEC_safe_push (ce_s, heap, tem, rhs);
do_deref (&tem);
rhs = VEC_index (ce_s, tem, 0);
VEC_free(ce_s, heap, tem);
@@ -4549,7 +4549,7 @@ find_func_aliases (gimple origt)
get_constraint_for_rhs (gimple_assign_rhs2 (t), &rhsc);
get_constraint_for_rhs (gimple_assign_rhs3 (t), &tmp);
FOR_EACH_VEC_ELT (ce_s, tmp, i, rhsp)
- VEC_safe_push (ce_s, heap, rhsc, rhsp);
+ VEC_safe_push (ce_s, heap, rhsc, *rhsp);
VEC_free (ce_s, heap, tmp);
}
else if (truth_value_p (code))
@@ -4567,7 +4567,7 @@ find_func_aliases (gimple origt)
{
get_constraint_for_rhs (gimple_op (t, i), &tmp);
FOR_EACH_VEC_ELT (ce_s, tmp, j, rhsp)
- VEC_safe_push (ce_s, heap, rhsc, rhsp);
+ VEC_safe_push (ce_s, heap, rhsc, *rhsp);
VEC_truncate (ce_s, tmp, 0);
}
VEC_free (ce_s, heap, tmp);
@@ -5191,13 +5191,8 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
if (!pair
&& offset + foff != 0)
{
- pair = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
- pair->offset = 0;
- pair->size = offset + foff;
- pair->has_unknown_size = false;
- pair->must_have_pointers = false;
- pair->may_have_pointers = false;
- pair->only_restrict_pointers = false;
+ fieldoff_s e = {0, offset + foff, false, false, false, false};
+ pair = VEC_safe_push (fieldoff_s, heap, *fieldstack, e);
}
if (!DECL_SIZE (field)
@@ -5217,19 +5212,20 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
}
else
{
- pair = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
- pair->offset = offset + foff;
- pair->has_unknown_size = has_unknown_size;
+ fieldoff_s e;
+ e.offset = offset + foff;
+ e.has_unknown_size = has_unknown_size;
if (!has_unknown_size)
- pair->size = TREE_INT_CST_LOW (DECL_SIZE (field));
+ e.size = TREE_INT_CST_LOW (DECL_SIZE (field));
else
- pair->size = -1;
- pair->must_have_pointers = must_have_pointers_p;
- pair->may_have_pointers = true;
- pair->only_restrict_pointers
+ e.size = -1;
+ e.must_have_pointers = must_have_pointers_p;
+ e.may_have_pointers = true;
+ e.only_restrict_pointers
= (!has_unknown_size
&& POINTER_TYPE_P (TREE_TYPE (field))
&& TYPE_RESTRICT (TREE_TYPE (field)));
+ VEC_safe_push (fieldoff_s, heap, *fieldstack, e);
}
}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index f8eb7233035..7ba11e193d6 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -68,7 +68,7 @@ redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus)
new_node.result = result;
new_node.locus = locus;
- VEC_safe_push (edge_var_map, heap, head, &new_node);
+ VEC_safe_push (edge_var_map, heap, head, new_node);
if (old_head != head)
{
/* The push did some reallocation. Update the pointer map. */
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index bb89d30fc32..bbbd3caca02 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -868,13 +868,11 @@ build_constructors (gimple swtch, struct switch_conv_info *info)
int k;
for (k = 0; k < info->phi_count; k++)
{
- constructor_elt *elt;
+ constructor_elt elt;
- elt = VEC_quick_push (constructor_elt,
- info->constructors[k], NULL);
- elt->index = int_const_binop (MINUS_EXPR, pos,
- info->range_min);
- elt->value = info->default_values[k];
+ elt.index = int_const_binop (MINUS_EXPR, pos, info->range_min);
+ elt.value = info->default_values[k];
+ VEC_quick_push (constructor_elt, info->constructors[k], elt);
}
pos = int_const_binop (PLUS_EXPR, pos, integer_one_node);
@@ -896,12 +894,11 @@ build_constructors (gimple swtch, struct switch_conv_info *info)
do
{
- constructor_elt *elt;
+ constructor_elt elt;
- elt = VEC_quick_push (constructor_elt,
- info->constructors[j], NULL);
- elt->index = int_const_binop (MINUS_EXPR, pos, info->range_min);
- elt->value = val;
+ elt.index = int_const_binop (MINUS_EXPR, pos, info->range_min);
+ elt.value = val;
+ VEC_quick_push (constructor_elt, info->constructors[j], elt);
pos = int_const_binop (PLUS_EXPR, pos, integer_one_node);
} while (!tree_int_cst_lt (high, pos)
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 5b583124cab..b217b1123e9 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -252,9 +252,8 @@ expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f,
i += delta, index = int_const_binop (PLUS_EXPR, index, part_width))
{
tree result = f (gsi, inner_type, a, b, index, part_width, code);
- constructor_elt *ce = VEC_quick_push (constructor_elt, v, NULL);
- ce->index = NULL_TREE;
- ce->value = result;
+ constructor_elt ce = {NULL_TREE, result};
+ VEC_quick_push (constructor_elt, v, ce);
}
return build_constructor (type, v);
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index fb354ae28d1..508dff0f714 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -214,7 +214,7 @@ adjust_debug_stmts (tree from, tree to, basic_block bb)
ai.bb = bb;
if (adjust_vec)
- VEC_safe_push (adjust_info, stack, adjust_vec, &ai);
+ VEC_safe_push (adjust_info, stack, adjust_vec, ai);
else
adjust_debug_stmts_now (&ai);
}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index b2d0a6b4042..11dbdfb5a02 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1099,7 +1099,7 @@ vect_slp_rearrange_stmts (slp_tree node, unsigned int group_size,
tmp_stmts = VEC_alloc (gimple, heap, group_size);
for (i = 0; i < group_size; i++)
- VEC_safe_push (gimple, heap, tmp_stmts, (gimple)NULL);
+ VEC_safe_push (gimple, heap, tmp_stmts, NULL);
FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
{
@@ -2663,7 +2663,7 @@ vect_create_mask_and_perm (gimple stmt, gimple next_scalar_stmt,
stmts later. */
for (i = VEC_length (gimple, SLP_TREE_VEC_STMTS (node));
i < (int) SLP_TREE_NUMBER_OF_VEC_STMTS (node); i++)
- VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (node), (gimple)NULL);
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (node), NULL);
perm_dest = vect_create_destination_var (gimple_assign_lhs (stmt), vectype);
for (i = 0; i < ncopies; i++)
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 76418386e1a..bad0fa24191 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -94,7 +94,7 @@ add_stmt_info_to_vec (stmt_vector_for_cost *stmt_cost_vec, int count,
si.kind = kind;
si.stmt = stmt;
si.misalign = misalign;
- VEC_safe_push (stmt_info_for_cost, heap, *stmt_cost_vec, &si);
+ VEC_safe_push (stmt_info_for_cost, heap, *stmt_cost_vec, si);
}
/************************************************************************
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 47c68d8710c..c0a4050a812 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8493,7 +8493,7 @@ simplify_switch_using_ranges (gimple stmt)
/* And queue an update for the stmt. */
su.stmt = stmt;
su.vec = vec2;
- VEC_safe_push (switch_update, heap, to_update_switch_stmts, &su);
+ VEC_safe_push (switch_update, heap, to_update_switch_stmts, su);
return false;
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 469f47356c8..a7492de8a92 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1443,12 +1443,10 @@ tree
build_constructor_single (tree type, tree index, tree value)
{
VEC(constructor_elt,gc) *v;
- constructor_elt *elt;
+ constructor_elt elt = {index, value};
v = VEC_alloc (constructor_elt, gc, 1);
- elt = VEC_quick_push (constructor_elt, v, NULL);
- elt->index = index;
- elt->value = value;
+ VEC_quick_push (constructor_elt, v, elt);
return build_constructor (type, v);
}
diff --git a/gcc/tree.h b/gcc/tree.h
index d81aa3c423c..ab5dd1e3f59 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1546,9 +1546,8 @@ struct GTY(()) tree_vec {
/* Append a new constructor element to V, with the specified INDEX and VAL. */
#define CONSTRUCTOR_APPEND_ELT(V, INDEX, VALUE) \
do { \
- constructor_elt *_ce___ = VEC_safe_push (constructor_elt, gc, V, NULL); \
- _ce___->index = INDEX; \
- _ce___->value = VALUE; \
+ constructor_elt _ce___ = {INDEX, VALUE}; \
+ VEC_safe_push (constructor_elt, gc, V, _ce___); \
} while (0)
/* True if NODE, a FIELD_DECL, is to be processed as a bitfield for
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 818fb2456b5..8c9ec48c240 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5510,7 +5510,7 @@ add_uses (rtx *ploc, void *data)
if (dump_file && (dump_flags & TDF_DETAILS))
log_op_type (mo.u.loc, cui->bb, cui->insn, mo.type, dump_file);
- VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &mo);
+ VEC_safe_push (micro_operation, heap, VTI (bb)->mos, mo);
}
return 0;
@@ -5794,7 +5794,7 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
if (dump_file && (dump_flags & TDF_DETAILS))
log_op_type (moa.u.loc, cui->bb, cui->insn,
moa.type, dump_file);
- VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &moa);
+ VEC_safe_push (micro_operation, heap, VTI (bb)->mos, moa);
}
resolve = false;
@@ -5881,7 +5881,7 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
log_and_return:
if (dump_file && (dump_flags & TDF_DETAILS))
log_op_type (mo.u.loc, cui->bb, cui->insn, mo.type, dump_file);
- VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &mo);
+ VEC_safe_push (micro_operation, heap, VTI (bb)->mos, mo);
}
/* Arguments to the call. */
@@ -6300,7 +6300,7 @@ add_with_sets (rtx insn, struct cselib_set *sets, int n_sets)
if (dump_file && (dump_flags & TDF_DETAILS))
log_op_type (PATTERN (insn), bb, insn, mo.type, dump_file);
- VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &mo);
+ VEC_safe_push (micro_operation, heap, VTI (bb)->mos, mo);
}
n1 = VEC_length (micro_operation, VTI (bb)->mos);
@@ -7864,7 +7864,9 @@ loc_exp_insert_dep (variable var, rtx x, htab_t vars)
led = (loc_exp_dep *) pool_alloc (loc_exp_dep_pool);
else
{
- VEC_quick_push (loc_exp_dep, VAR_LOC_DEP_VEC (var), NULL);
+ loc_exp_dep empty;
+ memset (&empty, 0, sizeof (empty));
+ VEC_quick_push (loc_exp_dep, VAR_LOC_DEP_VEC (var), empty);
led = &VEC_last (loc_exp_dep, VAR_LOC_DEP_VEC (var));
}
led->dv = var->dv;
@@ -9815,7 +9817,7 @@ vt_initialize (void)
log_op_type (PATTERN (insn), bb, insn,
MO_ADJUST, dump_file);
VEC_safe_push (micro_operation, heap, VTI (bb)->mos,
- &mo);
+ mo);
VTI (bb)->out.stack_adjust += pre;
}
}
@@ -9847,7 +9849,7 @@ vt_initialize (void)
log_op_type (PATTERN (insn), bb, insn,
MO_ADJUST, dump_file);
VEC_safe_push (micro_operation, heap, VTI (bb)->mos,
- &mo);
+ mo);
VTI (bb)->out.stack_adjust += post;
}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index d476b8ad7cd..a587c80fd34 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2999,9 +2999,8 @@ copy_constant (tree exp)
CONSTRUCTOR_ELTS (exp)));
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (exp), idx, purpose, value)
{
- constructor_elt *ce = VEC_quick_push (constructor_elt, v, NULL);
- ce->index = purpose;
- ce->value = copy_constant (value);
+ constructor_elt ce = {purpose, copy_constant (value)};
+ VEC_quick_push (constructor_elt, v, ce);
}
CONSTRUCTOR_ELTS (copy) = v;
return copy;
@@ -5563,9 +5562,8 @@ assemble_alias (tree decl, tree target)
do_assemble_alias (decl, target);
else
{
- alias_pair *p = VEC_safe_push (alias_pair, gc, alias_pairs, NULL);
- p->decl = decl;
- p->target = target;
+ alias_pair p = {decl, target};
+ VEC_safe_push (alias_pair, gc, alias_pairs, p);
}
}
@@ -5628,14 +5626,9 @@ static int
dump_tm_clone_to_vec (void **slot, void *info)
{
struct tree_map *map = (struct tree_map *) *slot;
- VEC(tm_alias_pair,heap) **tm_alias_pairs
- = (VEC(tm_alias_pair, heap) **) info;
- tm_alias_pair *p;
-
- p = VEC_safe_push (tm_alias_pair, heap, *tm_alias_pairs, NULL);
- p->from = map->base.from;
- p->to = map->to;
- p->uid = DECL_UID (p->from);
+ VEC(tm_alias_pair,heap) **tm_alias_pairs = (VEC(tm_alias_pair, heap) **) info;
+ tm_alias_pair p = {DECL_UID (map->base.from), map->base.from, map->to};
+ VEC_safe_push (tm_alias_pair, heap, *tm_alias_pairs, p);
return 1;
}
diff --git a/gcc/vec.h b/gcc/vec.h
index fbf95d22682..88891d74d7f 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -178,19 +178,15 @@ struct GTY(()) vec_t
bool space (int VEC_CHECK_DECL);
void splice (vec_t<T> * VEC_CHECK_DECL);
- T &quick_push (T VEC_CHECK_DECL);
- T *quick_push (const T * VEC_CHECK_DECL);
+ T *quick_push (const T & VEC_CHECK_DECL);
T &pop (ALONE_VEC_CHECK_DECL);
void truncate (unsigned VEC_CHECK_DECL);
- void replace (unsigned, T VEC_CHECK_DECL);
- void quick_insert (unsigned, T VEC_CHECK_DECL);
- void quick_insert (unsigned, const T * VEC_CHECK_DECL);
+ void replace (unsigned, const T & VEC_CHECK_DECL);
+ void quick_insert (unsigned, const T & VEC_CHECK_DECL);
void ordered_remove (unsigned VEC_CHECK_DECL);
void unordered_remove (unsigned VEC_CHECK_DECL);
void block_remove (unsigned, unsigned VEC_CHECK_DECL);
-
- unsigned lower_bound (T, bool (*)(T, T)) const;
- unsigned lower_bound (const T *, bool (*)(const T *, const T *)) const;
+ unsigned lower_bound (T, bool (*)(const T &, const T &)) const;
/* Class-static member functions. Some of these will become member
functions of a future handler class wrapping vec_t. */
@@ -221,10 +217,7 @@ struct GTY(()) vec_t
MEM_STAT_DECL);
template<enum vec_allocation_t A>
- static T &safe_push (vec_t<T> **, T VEC_CHECK_DECL MEM_STAT_DECL);
-
- template<enum vec_allocation_t A>
- static T *safe_push (vec_t<T> **, const T * VEC_CHECK_DECL MEM_STAT_DECL);
+ static T *safe_push (vec_t<T> **, const T & VEC_CHECK_DECL MEM_STAT_DECL);
template<enum vec_allocation_t A>
static void safe_grow (vec_t<T> **, int VEC_CHECK_DECL MEM_STAT_DECL);
@@ -233,11 +226,7 @@ struct GTY(()) vec_t
static void safe_grow_cleared (vec_t<T> **, int VEC_CHECK_DECL MEM_STAT_DECL);
template<enum vec_allocation_t A>
- static void safe_insert (vec_t<T> **, unsigned, T * VEC_CHECK_DECL
- MEM_STAT_DECL);
-
- template<enum vec_allocation_t A>
- static void safe_insert (vec_t<T> **, unsigned, T obj VEC_CHECK_DECL
+ static void safe_insert (vec_t<T> **, unsigned, const T & VEC_CHECK_DECL
MEM_STAT_DECL);
static bool iterate (const vec_t<T> *, unsigned, T *);
@@ -802,63 +791,32 @@ vec_t<T>::safe_splice (vec_t<T> **dst, vec_t<T> *src VEC_CHECK_DECL
}
-/* Push OBJ (a new element) onto the end, returns a reference to the slot
- filled in. There must be sufficient space in the vector. */
-
-template<typename T>
-T &
-vec_t<T>::quick_push (T obj VEC_CHECK_DECL)
-{
- VEC_ASSERT (prefix_.num_ < prefix_.alloc_, "push", T, base);
- vec_[prefix_.num_] = obj;
- T &val = vec_[prefix_.num_];
- prefix_.num_++;
- return val;
-}
+/* Push OBJ (a new element) onto the end of the vector. There must be
+ sufficient space in the vector. Return a pointer to the slot
+ where OBJ was inserted. */
-/* Push PTR (a new pointer to an element) onto the end, returns a
- pointer to the slot filled in. The new value can be NULL, in which
- case NO initialization is performed. There must be sufficient
- space in the vector. */
-
template<typename T>
T *
-vec_t<T>::quick_push (const T *ptr VEC_CHECK_DECL)
+vec_t<T>::quick_push (const T &obj VEC_CHECK_DECL)
{
VEC_ASSERT (prefix_.num_ < prefix_.alloc_, "push", T, base);
T *slot = &vec_[prefix_.num_++];
- if (ptr)
- *slot = *ptr;
+ *slot = obj;
return slot;
}
-/* Push a new element OBJ onto the end of VEC. Returns a reference to
- the slot filled in. Reallocates V, if needed. */
-
-template<typename T>
-template<enum vec_allocation_t A>
-T &
-vec_t<T>::safe_push (vec_t<T> **vec, T obj VEC_CHECK_DECL MEM_STAT_DECL)
-{
- reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT);
- return (*vec)->quick_push (obj VEC_CHECK_PASS);
-}
-
-
-/* Push a pointer PTR to a new element onto the end of VEC. Returns a
- pointer to the slot filled in. For object vectors, the new value
- can be NULL, in which case NO initialization is performed.
- Reallocates VEC, if needed. */
+/* Push a new element OBJ onto the end of VEC. Reallocates VEC, if
+ needed. Return a pointer to the slot where OBJ was inserted. */
template<typename T>
template<enum vec_allocation_t A>
T *
-vec_t<T>::safe_push (vec_t<T> **vec, const T *ptr VEC_CHECK_DECL MEM_STAT_DECL)
+vec_t<T>::safe_push (vec_t<T> **vec, const T &obj VEC_CHECK_DECL MEM_STAT_DECL)
{
reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT);
- return (*vec)->quick_push (ptr VEC_CHECK_PASS);
+ return (*vec)->quick_push (obj VEC_CHECK_PASS);
}
@@ -923,7 +881,7 @@ vec_t<T>::safe_grow_cleared (vec_t<T> **vec, int size VEC_CHECK_DECL
template<typename T>
void
-vec_t<T>::replace (unsigned ix, T obj VEC_CHECK_DECL)
+vec_t<T>::replace (unsigned ix, const T &obj VEC_CHECK_DECL)
{
VEC_ASSERT (ix < prefix_.num_, "replace", T, base);
vec_[ix] = obj;
@@ -935,7 +893,7 @@ vec_t<T>::replace (unsigned ix, T obj VEC_CHECK_DECL)
template<typename T>
void
-vec_t<T>::quick_insert (unsigned ix, T obj VEC_CHECK_DECL)
+vec_t<T>::quick_insert (unsigned ix, const T &obj VEC_CHECK_DECL)
{
VEC_ASSERT (prefix_.num_ < prefix_.alloc_, "insert", T, base);
VEC_ASSERT (ix <= prefix_.num_, "insert", T, base);
@@ -945,30 +903,13 @@ vec_t<T>::quick_insert (unsigned ix, T obj VEC_CHECK_DECL)
}
-/* Insert an element, *PTR, at the IXth position of V. The new value
- can be NULL, in which case no initialization of the inserted slot
- takes place. There must be sufficient space. */
-
-template<typename T>
-void
-vec_t<T>::quick_insert (unsigned ix, const T *ptr VEC_CHECK_DECL)
-{
- VEC_ASSERT (prefix_.num_ < prefix_.alloc_, "insert", T, base);
- VEC_ASSERT (ix <= prefix_.num_, "insert", T, base);
- T *slot = &vec_[ix];
- memmove (slot + 1, slot, (prefix_.num_++ - ix) * sizeof (T));
- if (ptr)
- *slot = *ptr;
-}
-
-
-/* Insert an element, VAL, at the IXth position of VEC. Reallocate
+/* Insert an element, OBJ, at the IXth position of VEC. Reallocate
VEC, if necessary. */
template<typename T>
template<enum vec_allocation_t A>
void
-vec_t<T>::safe_insert (vec_t<T> **vec, unsigned ix, T obj VEC_CHECK_DECL
+vec_t<T>::safe_insert (vec_t<T> **vec, unsigned ix, const T &obj VEC_CHECK_DECL
MEM_STAT_DECL)
{
reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT);
@@ -976,22 +917,6 @@ vec_t<T>::safe_insert (vec_t<T> **vec, unsigned ix, T obj VEC_CHECK_DECL
}
-/* Insert an element, *PTR, at the IXth position of VEC. Return a pointer
- to the slot created. For vectors of object, the new value can be
- NULL, in which case no initialization of the inserted slot takes
- place. Reallocate V, if necessary. */
-
-template<typename T>
-template<enum vec_allocation_t A>
-void
-vec_t<T>::safe_insert (vec_t<T> **vec, unsigned ix, T *ptr VEC_CHECK_DECL
- MEM_STAT_DECL)
-{
- reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT);
- (*vec)->quick_insert (ix, ptr VEC_CHECK_PASS);
-}
-
-
/* Remove an element from the IXth position of this vector. Ordering of
remaining elements is preserved. This is an O(N) operation due to
a memmove. */
@@ -1043,14 +968,14 @@ vec_t<T>::block_remove (unsigned ix, unsigned len VEC_CHECK_DECL)
template<typename T>
unsigned
-vec_t<T>::lower_bound (T obj, bool (*lessthan)(T, T)) const
+vec_t<T>::lower_bound (T obj, bool (*lessthan)(const T &, const T &)) const
{
unsigned int len = VEC_length (T, this);
unsigned int half, middle;
unsigned int first = 0;
while (len > 0)
{
- half = len >> 1;
+ half = len / 2;
middle = first;
middle += half;
T middle_elem = (*this)[middle];
@@ -1067,38 +992,6 @@ vec_t<T>::lower_bound (T obj, bool (*lessthan)(T, T)) const
}
-/* Find and return the first position in which *PTR could be inserted
- without changing the ordering of this vector. LESSTHAN is a
- function that returns true if the first argument is strictly less
- than the second. */
-
-template<typename T>
-unsigned
-vec_t<T>::lower_bound (const T *ptr,
- bool (*lessthan)(const T *, const T *)) const
-{
- unsigned int len = VEC_length (T, this);
- unsigned int half, middle;
- unsigned int first = 0;
- while (len > 0)
- {
- half = len >> 1;
- middle = first;
- middle += half;
- const T *middle_elem = &(*this)[middle];
- if (lessthan (middle_elem, ptr))
- {
- first = middle;
- ++first;
- len = len - half - 1;
- }
- else
- len = half;
- }
- return first;
-}
-
-
void *vec_heap_o_reserve_1 (void *, int, size_t, size_t, bool MEM_STAT_DECL);
void *vec_gc_o_reserve_1 (void *, int, size_t, size_t, bool MEM_STAT_DECL);