Commit 9ba5ff0f by Nathan Sidwell Committed by Nathan Sidwell

vec.h: Propagate location information properly.

.:	* vec.h: Propagate location information properly.
	(VEC_T_iterate): Add result pointer parameter.
	(VEC_T_space): New.
	(VEC_T_reserve): Use it.
cp:
	* class.c (add_method): Delay adding the slot until the end.
	(determine_primary_base): Adjust VEC_iterate invokation.
	(resort_type_method_vec, finish_struct_methods, warn_hidden,
	walk_subobject_offsets, end_of_class, warn_about_ambiguous_bases,
	build_vtbl_initializer): Likewise.
	* init.c (sort_mem_initializers, build_delete, push_base_cleanups,
	build_vbase_delete): Likewise.
	* method.c (do_build_copy_constructor): Likewise.
	* name-lookup.c (new_class_binding, print_binding_level,
	poplevel_class, store_class_bindings, push_to_top_level,
	pop_from_top_level): Likewise.
	* pt.c (check_explicit_specialization): Likewise.
	* search.c (lookup_conversion_operator, lookup_fnfields_1,
	get_pure_virtuals, add_conversions, dfs_check_overlap,
	binfo_for_vbase): Likewise.

From-SVN: r84924
parent 6df91b00
2004-07-19 Nathan Sidwell <nathan@codesourcery.com>
* vec.h: Propagate location information properly.
(VEC_T_iterate): Add result pointer parameter.
(VEC_T_space): New.
(VEC_T_reserve): Use it.
2004-07-19 Daniel Jacobowitz <dan@debian.org> 2004-07-19 Daniel Jacobowitz <dan@debian.org>
* Makefile.in (c-format.o): Depend on c-format.h. * Makefile.in (c-format.o): Depend on c-format.h.
......
2004-07-19 Nathan Sidwell <nathan@codesourcery.com>
* class.c (add_method): Delay adding the slot until the end.
(determine_primary_base): Adjust VEC_iterate invokation.
(resort_type_method_vec, finish_struct_methods, warn_hidden,
walk_subobject_offsets, end_of_class, warn_about_ambiguous_bases,
build_vtbl_initializer): Likewise.
* init.c (sort_mem_initializers, build_delete, push_base_cleanups,
build_vbase_delete): Likewise.
* method.c (do_build_copy_constructor): Likewise.
* name-lookup.c (new_class_binding, print_binding_level,
poplevel_class, store_class_bindings, push_to_top_level,
pop_from_top_level): Likewise.
* pt.c (check_explicit_specialization): Likewise.
* search.c (lookup_conversion_operator, lookup_fnfields_1,
get_pure_virtuals, add_conversions, dfs_check_overlap,
binfo_for_vbase): Likewise.
2004-07-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2004-07-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/12170 PR c++/12170
......
...@@ -801,12 +801,13 @@ void ...@@ -801,12 +801,13 @@ void
add_method (tree type, tree method) add_method (tree type, tree method)
{ {
int using; int using;
size_t len; unsigned slot;
size_t slot;
tree overload; tree overload;
int template_conv_p; int template_conv_p;
VEC(tree) *method_vec; VEC(tree) *method_vec;
bool complete_p; bool complete_p;
bool insert_p = false;
tree current_fns;
if (method == error_mark_node) if (method == error_mark_node)
return; return;
...@@ -830,8 +831,6 @@ add_method (tree type, tree method) ...@@ -830,8 +831,6 @@ add_method (tree type, tree method)
CLASSTYPE_METHOD_VEC (type) = method_vec; CLASSTYPE_METHOD_VEC (type) = method_vec;
} }
len = VEC_length (tree, method_vec);
/* Constructors and destructors go in special slots. */ /* Constructors and destructors go in special slots. */
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (method)) if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (method))
slot = CLASSTYPE_CONSTRUCTOR_SLOT; slot = CLASSTYPE_CONSTRUCTOR_SLOT;
...@@ -848,13 +847,13 @@ add_method (tree type, tree method) ...@@ -848,13 +847,13 @@ add_method (tree type, tree method)
} }
else else
{ {
bool insert_p = true;
bool conv_p = DECL_CONV_FN_P (method); bool conv_p = DECL_CONV_FN_P (method);
tree m; tree m;
insert_p = true;
/* See if we already have an entry with this name. */ /* See if we already have an entry with this name. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT; for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
(m = VEC_iterate (tree, method_vec, slot)); VEC_iterate (tree, method_vec, slot, m);
++slot) ++slot)
{ {
m = OVL_CURRENT (m); m = OVL_CURRENT (m);
...@@ -877,25 +876,9 @@ add_method (tree type, tree method) ...@@ -877,25 +876,9 @@ add_method (tree type, tree method)
&& DECL_NAME (m) > DECL_NAME (method)) && DECL_NAME (m) > DECL_NAME (method))
break; break;
} }
/* If we need a new slot, make room. */
if (insert_p)
{
/* We expect to add few methods in the COMPLETE_P case, so
just make room for one more method. */
if (complete_p)
VEC_reserve (tree, method_vec, 1);
if (slot == len)
VEC_safe_push (tree, method_vec, NULL_TREE);
else
VEC_safe_insert (tree, method_vec, slot, NULL_TREE);
len++;
/* Inserting a new slot may have caused the vector to be
reallocated. */
CLASSTYPE_METHOD_VEC (type) = method_vec;
}
} }
current_fns = insert_p ? NULL_TREE : VEC_index (tree, method_vec, slot);
if (processing_template_decl) if (processing_template_decl)
/* TYPE is a template class. Don't issue any errors now; wait /* TYPE is a template class. Don't issue any errors now; wait
until instantiation time to complain. */ until instantiation time to complain. */
...@@ -905,9 +888,7 @@ add_method (tree type, tree method) ...@@ -905,9 +888,7 @@ add_method (tree type, tree method)
tree fns; tree fns;
/* Check to see if we've already got this method. */ /* Check to see if we've already got this method. */
for (fns = VEC_index (tree, method_vec, slot); for (fns = current_fns; fns; fns = OVL_NEXT (fns))
fns;
fns = OVL_NEXT (fns))
{ {
tree fn = OVL_CURRENT (fns); tree fn = OVL_CURRENT (fns);
tree parms1; tree parms1;
...@@ -975,14 +956,25 @@ add_method (tree type, tree method) ...@@ -975,14 +956,25 @@ add_method (tree type, tree method)
} }
/* Add the new binding. */ /* Add the new binding. */
overload = build_overload (method, VEC_index (tree, method_vec, slot)); overload = build_overload (method, current_fns);
if (!DECL_CONSTRUCTOR_P (method)
&& !DECL_DESTRUCTOR_P (method) if (slot >= CLASSTYPE_FIRST_CONVERSION_SLOT && !complete_p)
&& !complete_p)
push_class_level_binding (DECL_NAME (method), overload); push_class_level_binding (DECL_NAME (method), overload);
/* Actually insert the new method. */ if (insert_p)
VEC_replace (tree, method_vec, slot, overload); {
/* We only expect to add few methods in the COMPLETE_P case, so
just make room for one more method in that case. */
if (VEC_reserve (tree, method_vec, complete_p ? 1 : -1))
CLASSTYPE_METHOD_VEC (type) = method_vec;
if (slot == VEC_length (tree, method_vec))
VEC_quick_push (tree, method_vec, overload);
else
VEC_quick_insert (tree, method_vec, slot, overload);
}
else
/* Replace the current slot. */
VEC_replace (tree, method_vec, slot, overload);
} }
/* Subroutines of finish_struct. */ /* Subroutines of finish_struct. */
...@@ -1275,8 +1267,9 @@ static void ...@@ -1275,8 +1267,9 @@ static void
determine_primary_base (tree t) determine_primary_base (tree t)
{ {
unsigned i, n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); unsigned i, n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
tree type_binfo; tree type_binfo = TYPE_BINFO (t);
tree vbase_binfo; tree vbase_binfo;
VEC(tree) *vbases;
/* If there are no baseclasses, there is certainly no primary base. */ /* If there are no baseclasses, there is certainly no primary base. */
if (n_baseclasses == 0) if (n_baseclasses == 0)
...@@ -1324,8 +1317,8 @@ determine_primary_base (tree t) ...@@ -1324,8 +1317,8 @@ determine_primary_base (tree t)
/* Find the indirect primary bases - those virtual bases which are primary /* Find the indirect primary bases - those virtual bases which are primary
bases of something else in this hierarchy. */ bases of something else in this hierarchy. */
for (i = 0; (vbase_binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
(tree, CLASSTYPE_VBASECLASSES (t), i)); i++) VEC_iterate (tree, vbases, i, vbase_binfo); i++)
{ {
unsigned j; unsigned j;
...@@ -1335,11 +1328,12 @@ determine_primary_base (tree t) ...@@ -1335,11 +1328,12 @@ determine_primary_base (tree t)
for (j = 0; j != n_baseclasses; ++j) for (j = 0; j != n_baseclasses; ++j)
{ {
unsigned k; unsigned k;
VEC (tree) *base_vbases;
tree base_vbase_binfo; tree base_vbase_binfo;
tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), j)); tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), j));
for (k = 0; (base_vbase_binfo = VEC_iterate for (base_vbases = CLASSTYPE_VBASECLASSES (basetype), k = 0;
(tree, CLASSTYPE_VBASECLASSES (basetype), k)); k++) VEC_iterate (tree, base_vbases, k, base_vbase_binfo); k++)
{ {
if (BINFO_PRIMARY_P (base_vbase_binfo) if (BINFO_PRIMARY_P (base_vbase_binfo)
&& same_type_p (BINFO_TYPE (base_vbase_binfo), && same_type_p (BINFO_TYPE (base_vbase_binfo),
...@@ -1677,7 +1671,7 @@ resort_type_method_vec (void* obj, ...@@ -1677,7 +1671,7 @@ resort_type_method_vec (void* obj,
/* The type conversion ops have to live at the front of the vec, so we /* The type conversion ops have to live at the front of the vec, so we
can't sort them. */ can't sort them. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT; for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
(fn = VEC_iterate (tree, method_vec, slot)); VEC_iterate (tree, method_vec, slot, fn);
++slot) ++slot)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn))) if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
break; break;
...@@ -1738,8 +1732,8 @@ finish_struct_methods (tree t) ...@@ -1738,8 +1732,8 @@ finish_struct_methods (tree t)
/* The type conversion ops have to live at the front of the vec, so we /* The type conversion ops have to live at the front of the vec, so we
can't sort them. */ can't sort them. */
for (slot = 2; for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
(fn_fields = VEC_iterate (tree, method_vec, slot)); VEC_iterate (tree, method_vec, slot, fn_fields);
++slot) ++slot)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn_fields))) if (!DECL_CONV_FN_P (OVL_CURRENT (fn_fields)))
break; break;
...@@ -2369,7 +2363,7 @@ warn_hidden (tree t) ...@@ -2369,7 +2363,7 @@ warn_hidden (tree t)
/* We go through each separately named virtual function. */ /* We go through each separately named virtual function. */
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT; for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
(fns = VEC_iterate (tree, method_vec, i)); VEC_iterate (tree, method_vec, i, fns);
++i) ++i)
{ {
tree fn; tree fn;
...@@ -3229,6 +3223,7 @@ walk_subobject_offsets (tree type, ...@@ -3229,6 +3223,7 @@ walk_subobject_offsets (tree type,
if (abi_version_at_least (2) && CLASSTYPE_VBASECLASSES (type)) if (abi_version_at_least (2) && CLASSTYPE_VBASECLASSES (type))
{ {
unsigned ix; unsigned ix;
VEC (tree) *vbases;
/* Iterate through the virtual base classes of TYPE. In G++ /* Iterate through the virtual base classes of TYPE. In G++
3.2, we included virtual bases in the direct base class 3.2, we included virtual bases in the direct base class
...@@ -3236,8 +3231,8 @@ walk_subobject_offsets (tree type, ...@@ -3236,8 +3231,8 @@ walk_subobject_offsets (tree type,
correct offsets for virtual bases are only known when correct offsets for virtual bases are only known when
working with the most derived type. */ working with the most derived type. */
if (vbases_p) if (vbases_p)
for (ix = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
(tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++) VEC_iterate (tree, vbases, ix, binfo); ix++)
{ {
r = walk_subobject_offsets (binfo, r = walk_subobject_offsets (binfo,
f, f,
...@@ -4402,7 +4397,9 @@ static tree ...@@ -4402,7 +4397,9 @@ static tree
end_of_class (tree t, int include_virtuals_p) end_of_class (tree t, int include_virtuals_p)
{ {
tree result = size_zero_node; tree result = size_zero_node;
VEC (tree) *vbases;
tree binfo; tree binfo;
tree base_binfo;
tree offset; tree offset;
int i; int i;
...@@ -4422,10 +4419,10 @@ end_of_class (tree t, int include_virtuals_p) ...@@ -4422,10 +4419,10 @@ end_of_class (tree t, int include_virtuals_p)
/* G++ 3.2 did not check indirect virtual bases. */ /* G++ 3.2 did not check indirect virtual bases. */
if (abi_version_at_least (2) && include_virtuals_p) if (abi_version_at_least (2) && include_virtuals_p)
for (i = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
(tree, CLASSTYPE_VBASECLASSES (t), i)); i++) VEC_iterate (tree, vbases, i, base_binfo); i++)
{ {
offset = end_of_base (binfo); offset = end_of_base (base_binfo);
if (INT_CST_LT_UNSIGNED (result, offset)) if (INT_CST_LT_UNSIGNED (result, offset))
result = offset; result = offset;
} }
...@@ -4447,11 +4444,13 @@ static void ...@@ -4447,11 +4444,13 @@ static void
warn_about_ambiguous_bases (tree t) warn_about_ambiguous_bases (tree t)
{ {
int i; int i;
VEC (tree) *vbases;
tree basetype; tree basetype;
tree binfo; tree binfo;
/* Check direct bases. */ /* Check direct bases. */
for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); ++i) for (i = 0;
i < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); ++i)
{ {
basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), i)); basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), i));
...@@ -4462,8 +4461,8 @@ warn_about_ambiguous_bases (tree t) ...@@ -4462,8 +4461,8 @@ warn_about_ambiguous_bases (tree t)
/* Check for ambiguous virtual bases. */ /* Check for ambiguous virtual bases. */
if (extra_warnings) if (extra_warnings)
for (i = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
(tree, CLASSTYPE_VBASECLASSES (t), i)); i++) VEC_iterate (tree, vbases, i, binfo); i++)
{ {
basetype = BINFO_TYPE (binfo); basetype = BINFO_TYPE (binfo);
...@@ -7237,7 +7236,8 @@ build_vtbl_initializer (tree binfo, ...@@ -7237,7 +7236,8 @@ build_vtbl_initializer (tree binfo,
vtbl_init_data vid; vtbl_init_data vid;
unsigned ix; unsigned ix;
tree vbinfo; tree vbinfo;
VEC (tree) *vbases;
/* Initialize VID. */ /* Initialize VID. */
memset (&vid, 0, sizeof (vid)); memset (&vid, 0, sizeof (vid));
vid.binfo = binfo; vid.binfo = binfo;
...@@ -7262,8 +7262,8 @@ build_vtbl_initializer (tree binfo, ...@@ -7262,8 +7262,8 @@ build_vtbl_initializer (tree binfo,
/* Clear BINFO_VTABLE_PATH_MARKED; it's set by /* Clear BINFO_VTABLE_PATH_MARKED; it's set by
build_vbase_offset_vtbl_entries. */ build_vbase_offset_vtbl_entries. */
for (ix = 0; (vbinfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
(tree, CLASSTYPE_VBASECLASSES (t), ix)); ix++) VEC_iterate (tree, vbases, ix, vbinfo); ix++)
BINFO_VTABLE_PATH_MARKED (vbinfo) = 0; BINFO_VTABLE_PATH_MARKED (vbinfo) = 0;
/* If the target requires padding between data entries, add that now. */ /* If the target requires padding between data entries, add that now. */
......
...@@ -460,6 +460,7 @@ sort_mem_initializers (tree t, tree mem_inits) ...@@ -460,6 +460,7 @@ sort_mem_initializers (tree t, tree mem_inits)
tree base; tree base;
tree sorted_inits; tree sorted_inits;
tree next_subobject; tree next_subobject;
VEC (tree) *vbases;
int i; int i;
int uses_unions_p; int uses_unions_p;
...@@ -470,8 +471,8 @@ sort_mem_initializers (tree t, tree mem_inits) ...@@ -470,8 +471,8 @@ sort_mem_initializers (tree t, tree mem_inits)
sorted_inits = NULL_TREE; sorted_inits = NULL_TREE;
/* Process the virtual bases. */ /* Process the virtual bases. */
for (i = 0; (base = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
(tree, CLASSTYPE_VBASECLASSES (t), i)); i++) VEC_iterate (tree, vbases, i, base); i++)
sorted_inits = tree_cons (base, NULL_TREE, sorted_inits); sorted_inits = tree_cons (base, NULL_TREE, sorted_inits);
/* Process the direct bases. */ /* Process the direct bases. */
...@@ -2857,10 +2858,11 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, ...@@ -2857,10 +2858,11 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
void void
push_base_cleanups (void) push_base_cleanups (void)
{ {
tree binfos; tree binfos, base_binfo;
int i, n_baseclasses; int i, n_baseclasses;
tree member; tree member;
tree expr; tree expr;
VEC (tree) *vbases;
/* Run destructors for all virtual baseclasses. */ /* Run destructors for all virtual baseclasses. */
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
...@@ -2872,16 +2874,15 @@ push_base_cleanups (void) ...@@ -2872,16 +2874,15 @@ push_base_cleanups (void)
/* The CLASSTYPE_VBASECLASSES vector is in initialization /* The CLASSTYPE_VBASECLASSES vector is in initialization
order, which is also the right order for pushing cleanups. */ order, which is also the right order for pushing cleanups. */
for (i = 0; (binfos = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
(tree, CLASSTYPE_VBASECLASSES (current_class_type), i)); VEC_iterate (tree, vbases, i, base_binfo); i++)
i++)
{ {
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (BINFO_TYPE (binfos))) if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo)))
{ {
expr = build_special_member_call (current_class_ref, expr = build_special_member_call (current_class_ref,
base_dtor_identifier, base_dtor_identifier,
NULL_TREE, NULL_TREE,
binfos, base_binfo,
(LOOKUP_NORMAL (LOOKUP_NORMAL
| LOOKUP_NONVIRTUAL)); | LOOKUP_NONVIRTUAL));
expr = build (COND_EXPR, void_type_node, cond, expr = build (COND_EXPR, void_type_node, cond,
...@@ -2938,13 +2939,14 @@ build_vbase_delete (tree type, tree decl) ...@@ -2938,13 +2939,14 @@ build_vbase_delete (tree type, tree decl)
unsigned ix; unsigned ix;
tree binfo; tree binfo;
tree result; tree result;
VEC (tree) *vbases;
tree addr = build_unary_op (ADDR_EXPR, decl, 0); tree addr = build_unary_op (ADDR_EXPR, decl, 0);
my_friendly_assert (addr != error_mark_node, 222); my_friendly_assert (addr != error_mark_node, 222);
result = convert_to_void (integer_zero_node, NULL); result = convert_to_void (integer_zero_node, NULL);
for (ix = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
(tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++) VEC_iterate (tree, vbases, ix, binfo); ix++)
{ {
tree base_addr = convert_force tree base_addr = convert_force
(build_pointer_type (BINFO_TYPE (binfo)), addr, 0); (build_pointer_type (BINFO_TYPE (binfo)), addr, 0);
......
...@@ -521,15 +521,15 @@ do_build_copy_constructor (tree fndecl) ...@@ -521,15 +521,15 @@ do_build_copy_constructor (tree fndecl)
int cvquals = cp_type_quals (TREE_TYPE (parm)); int cvquals = cp_type_quals (TREE_TYPE (parm));
int i; int i;
tree binfo; tree binfo;
VEC (tree) *vbases;
/* Initialize all the base-classes with the parameter converted /* Initialize all the base-classes with the parameter converted
to their type so that we get their copy constructor and not to their type so that we get their copy constructor and not
another constructor that takes current_class_type. We must another constructor that takes current_class_type. We must
deal with the binfo's directly as a direct base might be deal with the binfo's directly as a direct base might be
inaccessible due to ambiguity. */ inaccessible due to ambiguity. */
for (i = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
(tree, CLASSTYPE_VBASECLASSES (current_class_type), i)); VEC_iterate (tree, vbases, i, binfo); i++)
i++)
{ {
member_init_list member_init_list
= tree_cons (binfo, = tree_cons (binfo,
......
...@@ -387,7 +387,7 @@ new_class_binding (tree name, tree value, tree type, cxx_scope *scope) ...@@ -387,7 +387,7 @@ new_class_binding (tree name, tree value, tree type, cxx_scope *scope)
size_t i; size_t i;
for (i = 0; for (i = 0;
(cb = VEC_iterate (cp_class_binding, scope->class_shadowed, i)); VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb);
i++) i++)
{ {
cxx_binding **b; cxx_binding **b;
...@@ -1656,9 +1656,7 @@ print_binding_level (struct cp_binding_level* lvl) ...@@ -1656,9 +1656,7 @@ print_binding_level (struct cp_binding_level* lvl)
cp_class_binding *b; cp_class_binding *b;
fprintf (stderr, " class-shadowed:"); fprintf (stderr, " class-shadowed:");
for (i = 0; for (i = 0;
(b = VEC_iterate(cp_class_binding, VEC_iterate(cp_class_binding, lvl->class_shadowed, i, b);
lvl->class_shadowed,
i));
++i) ++i)
fprintf (stderr, " %s ", IDENTIFIER_POINTER (b->identifier)); fprintf (stderr, " %s ", IDENTIFIER_POINTER (b->identifier));
fprintf (stderr, "\n"); fprintf (stderr, "\n");
...@@ -2617,7 +2615,7 @@ poplevel_class (void) ...@@ -2617,7 +2615,7 @@ poplevel_class (void)
if (level->class_shadowed) if (level->class_shadowed)
{ {
for (i = 0; for (i = 0;
(cb = VEC_iterate (cp_class_binding, level->class_shadowed, i)); VEC_iterate (cp_class_binding, level->class_shadowed, i, cb);
++i) ++i)
IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; IDENTIFIER_BINDING (cb->identifier) = cb->base.previous;
ggc_free (level->class_shadowed); ggc_free (level->class_shadowed);
...@@ -4924,9 +4922,7 @@ store_class_bindings (VEC(cp_class_binding) *names, ...@@ -4924,9 +4922,7 @@ store_class_bindings (VEC(cp_class_binding) *names,
cp_class_binding *cb; cp_class_binding *cb;
timevar_push (TV_NAME_LOOKUP); timevar_push (TV_NAME_LOOKUP);
for (i = 0; for (i = 0; VEC_iterate(cp_class_binding, names, i, cb); ++i)
(cb = VEC_iterate(cp_class_binding, names, i));
++i)
store_binding (cb->identifier, old_bindings); store_binding (cb->identifier, old_bindings);
timevar_pop (TV_NAME_LOOKUP); timevar_pop (TV_NAME_LOOKUP);
} }
...@@ -4982,9 +4978,7 @@ push_to_top_level (void) ...@@ -4982,9 +4978,7 @@ push_to_top_level (void)
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t)); SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
} }
for (i = 0; for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, sb); ++i)
(sb = VEC_iterate (cxx_saved_binding, s->old_bindings, i));
++i)
IDENTIFIER_MARKED (sb->identifier) = 0; IDENTIFIER_MARKED (sb->identifier) = 0;
s->prev = scope_chain; s->prev = scope_chain;
...@@ -5015,9 +5009,7 @@ pop_from_top_level (void) ...@@ -5015,9 +5009,7 @@ pop_from_top_level (void)
current_lang_base = 0; current_lang_base = 0;
scope_chain = s->prev; scope_chain = s->prev;
for (i = 0; for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, saved); ++i)
(saved = VEC_iterate (cxx_saved_binding, s->old_bindings, i));
++i)
{ {
tree id = saved->identifier; tree id = saved->identifier;
......
...@@ -1838,7 +1838,7 @@ check_explicit_specialization (tree declarator, ...@@ -1838,7 +1838,7 @@ check_explicit_specialization (tree declarator,
methods = CLASSTYPE_METHOD_VEC (ctype); methods = CLASSTYPE_METHOD_VEC (ctype);
if (methods) if (methods)
for (idx = CLASSTYPE_FIRST_CONVERSION_SLOT; for (idx = CLASSTYPE_FIRST_CONVERSION_SLOT;
(ovl = VEC_iterate (tree, methods, idx)); VEC_iterate (tree, methods, idx, ovl);
++idx) ++idx)
{ {
if (!DECL_CONV_FN_P (OVL_CURRENT (ovl))) if (!DECL_CONV_FN_P (OVL_CURRENT (ovl)))
......
...@@ -1319,8 +1319,7 @@ lookup_conversion_operator (tree class_type, tree type) ...@@ -1319,8 +1319,7 @@ lookup_conversion_operator (tree class_type, tree type)
for (pass = 0; pass < 2; ++pass) for (pass = 0; pass < 2; ++pass)
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT; for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
(fn = VEC_iterate (tree, methods, i)); VEC_iterate (tree, methods, i, fn); ++i)
++i)
{ {
/* All the conversion operators come near the beginning of the /* All the conversion operators come near the beginning of the
class. Therefore, if FN is not a conversion operator, there class. Therefore, if FN is not a conversion operator, there
...@@ -1410,7 +1409,7 @@ lookup_fnfields_1 (tree type, tree name) ...@@ -1410,7 +1409,7 @@ lookup_fnfields_1 (tree type, tree name)
/* Skip the conversion operators. */ /* Skip the conversion operators. */
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT; for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
(fn = VEC_iterate (tree, method_vec, i)); VEC_iterate (tree, method_vec, i, fn);
++i) ++i)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn))) if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
break; break;
...@@ -1442,9 +1441,7 @@ lookup_fnfields_1 (tree type, tree name) ...@@ -1442,9 +1441,7 @@ lookup_fnfields_1 (tree type, tree name)
} }
} }
else else
for (; for (; VEC_iterate (tree, method_vec, i, fn); ++i)
(fn = VEC_iterate (tree, method_vec, i));
++i)
{ {
#ifdef GATHER_STATISTICS #ifdef GATHER_STATISTICS
n_outer_fields_searched++; n_outer_fields_searched++;
...@@ -1887,6 +1884,7 @@ get_pure_virtuals (tree type) ...@@ -1887,6 +1884,7 @@ get_pure_virtuals (tree type)
{ {
unsigned ix; unsigned ix;
tree binfo; tree binfo;
VEC (tree) *vbases;
/* Clear the CLASSTYPE_PURE_VIRTUALS list; whatever is already there /* Clear the CLASSTYPE_PURE_VIRTUALS list; whatever is already there
is going to be overridden. */ is going to be overridden. */
...@@ -1903,8 +1901,8 @@ get_pure_virtuals (tree type) ...@@ -1903,8 +1901,8 @@ get_pure_virtuals (tree type)
/* Put the pure virtuals in dfs order. */ /* Put the pure virtuals in dfs order. */
CLASSTYPE_PURE_VIRTUALS (type) = nreverse (CLASSTYPE_PURE_VIRTUALS (type)); CLASSTYPE_PURE_VIRTUALS (type) = nreverse (CLASSTYPE_PURE_VIRTUALS (type));
for (ix = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
(tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++) VEC_iterate (tree, vbases, ix, binfo); ix++)
{ {
tree virtuals; tree virtuals;
...@@ -2078,12 +2076,12 @@ add_conversions (tree binfo, void *data) ...@@ -2078,12 +2076,12 @@ add_conversions (tree binfo, void *data)
return NULL_TREE; return NULL_TREE;
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT; for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
(tmp = VEC_iterate (tree, method_vec, i)); VEC_iterate (tree, method_vec, i, tmp);
++i) ++i)
{ {
tree name; tree name;
if (!tmp || ! DECL_CONV_FN_P (OVL_CURRENT (tmp))) if (!DECL_CONV_FN_P (OVL_CURRENT (tmp)))
break; break;
name = DECL_NAME (OVL_CURRENT (tmp)); name = DECL_NAME (OVL_CURRENT (tmp));
...@@ -2153,6 +2151,7 @@ dfs_check_overlap (tree empty_binfo, void *data) ...@@ -2153,6 +2151,7 @@ dfs_check_overlap (tree empty_binfo, void *data)
{ {
struct overlap_info *oi = (struct overlap_info *) data; struct overlap_info *oi = (struct overlap_info *) data;
tree binfo; tree binfo;
for (binfo = TYPE_BINFO (oi->compare_type); for (binfo = TYPE_BINFO (oi->compare_type);
; ;
binfo = BINFO_BASE_BINFO (binfo, 0)) binfo = BINFO_BASE_BINFO (binfo, 0))
...@@ -2308,9 +2307,10 @@ binfo_for_vbase (tree base, tree t) ...@@ -2308,9 +2307,10 @@ binfo_for_vbase (tree base, tree t)
{ {
unsigned ix; unsigned ix;
tree binfo; tree binfo;
VEC (tree) *vbases;
for (ix = 0; (binfo = VEC_iterate for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
(tree, CLASSTYPE_VBASECLASSES (t), ix)); ix++) VEC_iterate (tree, vbases, ix, binfo); ix++)
if (BINFO_TYPE (binfo) == base) if (BINFO_TYPE (binfo) == base)
return binfo; return binfo;
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment