summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-19 15:45:53 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-19 15:45:53 +0000
commit930bdacf3661fb4be93fae6554af8a706b9070ca (patch)
tree46c29242b882c33b8a12977fcf57e4b3cd23ce78
parent7c0f064134ed3797a8124108cafc5a2c8d8179d0 (diff)
downloadppe42-gcc-930bdacf3661fb4be93fae6554af8a706b9070ca.tar.gz
ppe42-gcc-930bdacf3661fb4be93fae6554af8a706b9070ca.zip
.:
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84924 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/class.c106
-rw-r--r--gcc/cp/init.c22
-rw-r--r--gcc/cp/method.c6
-rw-r--r--gcc/cp/name-lookup.c20
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/cp/search.c24
-rw-r--r--gcc/vec.h210
9 files changed, 259 insertions, 156 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ad0b3b7b525..7217195f069 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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>
* Makefile.in (c-format.o): Depend on c-format.h.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f4db5d3f256..dfd8d26229a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,21 @@
+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>
PR c++/12170
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index cc1dc763900..69f6d9e6e6f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -801,12 +801,13 @@ void
add_method (tree type, tree method)
{
int using;
- size_t len;
- size_t slot;
+ unsigned slot;
tree overload;
int template_conv_p;
VEC(tree) *method_vec;
bool complete_p;
+ bool insert_p = false;
+ tree current_fns;
if (method == error_mark_node)
return;
@@ -830,8 +831,6 @@ add_method (tree type, tree method)
CLASSTYPE_METHOD_VEC (type) = method_vec;
}
- len = VEC_length (tree, method_vec);
-
/* Constructors and destructors go in special slots. */
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (method))
slot = CLASSTYPE_CONSTRUCTOR_SLOT;
@@ -848,13 +847,13 @@ add_method (tree type, tree method)
}
else
{
- bool insert_p = true;
bool conv_p = DECL_CONV_FN_P (method);
tree m;
+ insert_p = true;
/* See if we already have an entry with this name. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (m = VEC_iterate (tree, method_vec, slot));
+ VEC_iterate (tree, method_vec, slot, m);
++slot)
{
m = OVL_CURRENT (m);
@@ -877,25 +876,9 @@ add_method (tree type, tree method)
&& DECL_NAME (m) > DECL_NAME (method))
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)
/* TYPE is a template class. Don't issue any errors now; wait
until instantiation time to complain. */
@@ -905,9 +888,7 @@ add_method (tree type, tree method)
tree fns;
/* Check to see if we've already got this method. */
- for (fns = VEC_index (tree, method_vec, slot);
- fns;
- fns = OVL_NEXT (fns))
+ for (fns = current_fns; fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
tree parms1;
@@ -975,14 +956,25 @@ add_method (tree type, tree method)
}
/* Add the new binding. */
- overload = build_overload (method, VEC_index (tree, method_vec, slot));
- if (!DECL_CONSTRUCTOR_P (method)
- && !DECL_DESTRUCTOR_P (method)
- && !complete_p)
+ overload = build_overload (method, current_fns);
+
+ if (slot >= CLASSTYPE_FIRST_CONVERSION_SLOT && !complete_p)
push_class_level_binding (DECL_NAME (method), overload);
- /* Actually insert the new method. */
- VEC_replace (tree, method_vec, slot, overload);
+ if (insert_p)
+ {
+ /* 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. */
@@ -1275,8 +1267,9 @@ static void
determine_primary_base (tree t)
{
unsigned i, n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
- tree type_binfo;
+ tree type_binfo = TYPE_BINFO (t);
tree vbase_binfo;
+ VEC(tree) *vbases;
/* If there are no baseclasses, there is certainly no primary base. */
if (n_baseclasses == 0)
@@ -1324,8 +1317,8 @@ determine_primary_base (tree t)
/* Find the indirect primary bases - those virtual bases which are primary
bases of something else in this hierarchy. */
- for (i = 0; (vbase_binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), i)); i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
+ VEC_iterate (tree, vbases, i, vbase_binfo); i++)
{
unsigned j;
@@ -1335,11 +1328,12 @@ determine_primary_base (tree t)
for (j = 0; j != n_baseclasses; ++j)
{
unsigned k;
+ VEC (tree) *base_vbases;
tree base_vbase_binfo;
tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), j));
- for (k = 0; (base_vbase_binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (basetype), k)); k++)
+ for (base_vbases = CLASSTYPE_VBASECLASSES (basetype), k = 0;
+ VEC_iterate (tree, base_vbases, k, base_vbase_binfo); k++)
{
if (BINFO_PRIMARY_P (base_vbase_binfo)
&& same_type_p (BINFO_TYPE (base_vbase_binfo),
@@ -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
can't sort them. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (fn = VEC_iterate (tree, method_vec, slot));
+ VEC_iterate (tree, method_vec, slot, fn);
++slot)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
break;
@@ -1738,8 +1732,8 @@ finish_struct_methods (tree t)
/* The type conversion ops have to live at the front of the vec, so we
can't sort them. */
- for (slot = 2;
- (fn_fields = VEC_iterate (tree, method_vec, slot));
+ for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
+ VEC_iterate (tree, method_vec, slot, fn_fields);
++slot)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn_fields)))
break;
@@ -2369,7 +2363,7 @@ warn_hidden (tree t)
/* We go through each separately named virtual function. */
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (fns = VEC_iterate (tree, method_vec, i));
+ VEC_iterate (tree, method_vec, i, fns);
++i)
{
tree fn;
@@ -3229,6 +3223,7 @@ walk_subobject_offsets (tree type,
if (abi_version_at_least (2) && CLASSTYPE_VBASECLASSES (type))
{
unsigned ix;
+ VEC (tree) *vbases;
/* Iterate through the virtual base classes of TYPE. In G++
3.2, we included virtual bases in the direct base class
@@ -3236,8 +3231,8 @@ walk_subobject_offsets (tree type,
correct offsets for virtual bases are only known when
working with the most derived type. */
if (vbases_p)
- for (ix = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++)
+ for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
+ VEC_iterate (tree, vbases, ix, binfo); ix++)
{
r = walk_subobject_offsets (binfo,
f,
@@ -4402,7 +4397,9 @@ static tree
end_of_class (tree t, int include_virtuals_p)
{
tree result = size_zero_node;
+ VEC (tree) *vbases;
tree binfo;
+ tree base_binfo;
tree offset;
int i;
@@ -4422,10 +4419,10 @@ end_of_class (tree t, int include_virtuals_p)
/* G++ 3.2 did not check indirect virtual bases. */
if (abi_version_at_least (2) && include_virtuals_p)
- for (i = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), i)); i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
+ 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))
result = offset;
}
@@ -4447,11 +4444,13 @@ static void
warn_about_ambiguous_bases (tree t)
{
int i;
+ VEC (tree) *vbases;
tree basetype;
tree binfo;
/* 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));
@@ -4462,8 +4461,8 @@ warn_about_ambiguous_bases (tree t)
/* Check for ambiguous virtual bases. */
if (extra_warnings)
- for (i = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), i)); i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
+ VEC_iterate (tree, vbases, i, binfo); i++)
{
basetype = BINFO_TYPE (binfo);
@@ -7237,7 +7236,8 @@ build_vtbl_initializer (tree binfo,
vtbl_init_data vid;
unsigned ix;
tree vbinfo;
-
+ VEC (tree) *vbases;
+
/* Initialize VID. */
memset (&vid, 0, sizeof (vid));
vid.binfo = binfo;
@@ -7262,8 +7262,8 @@ build_vtbl_initializer (tree binfo,
/* Clear BINFO_VTABLE_PATH_MARKED; it's set by
build_vbase_offset_vtbl_entries. */
- for (ix = 0; (vbinfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), ix)); ix++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
+ VEC_iterate (tree, vbases, ix, vbinfo); ix++)
BINFO_VTABLE_PATH_MARKED (vbinfo) = 0;
/* If the target requires padding between data entries, add that now. */
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 926dfcd9c89..988bfba1cd0 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -460,6 +460,7 @@ sort_mem_initializers (tree t, tree mem_inits)
tree base;
tree sorted_inits;
tree next_subobject;
+ VEC (tree) *vbases;
int i;
int uses_unions_p;
@@ -470,8 +471,8 @@ sort_mem_initializers (tree t, tree mem_inits)
sorted_inits = NULL_TREE;
/* Process the virtual bases. */
- for (i = 0; (base = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), i)); i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
+ VEC_iterate (tree, vbases, i, base); i++)
sorted_inits = tree_cons (base, NULL_TREE, sorted_inits);
/* Process the direct bases. */
@@ -2857,10 +2858,11 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
void
push_base_cleanups (void)
{
- tree binfos;
+ tree binfos, base_binfo;
int i, n_baseclasses;
tree member;
tree expr;
+ VEC (tree) *vbases;
/* Run destructors for all virtual baseclasses. */
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
@@ -2872,16 +2874,15 @@ push_base_cleanups (void)
/* The CLASSTYPE_VBASECLASSES vector is in initialization
order, which is also the right order for pushing cleanups. */
- for (i = 0; (binfos = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (current_class_type), i));
- i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
+ VEC_iterate (tree, vbases, i, base_binfo); 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,
base_dtor_identifier,
NULL_TREE,
- binfos,
+ base_binfo,
(LOOKUP_NORMAL
| LOOKUP_NONVIRTUAL));
expr = build (COND_EXPR, void_type_node, cond,
@@ -2938,13 +2939,14 @@ build_vbase_delete (tree type, tree decl)
unsigned ix;
tree binfo;
tree result;
+ VEC (tree) *vbases;
tree addr = build_unary_op (ADDR_EXPR, decl, 0);
my_friendly_assert (addr != error_mark_node, 222);
result = convert_to_void (integer_zero_node, NULL);
- for (ix = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++)
+ for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
+ VEC_iterate (tree, vbases, ix, binfo); ix++)
{
tree base_addr = convert_force
(build_pointer_type (BINFO_TYPE (binfo)), addr, 0);
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 984e0e90557..802d4c023fe 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -521,15 +521,15 @@ do_build_copy_constructor (tree fndecl)
int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
tree binfo;
+ VEC (tree) *vbases;
/* Initialize all the base-classes with the parameter converted
to their type so that we get their copy constructor and not
another constructor that takes current_class_type. We must
deal with the binfo's directly as a direct base might be
inaccessible due to ambiguity. */
- for (i = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (current_class_type), i));
- i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
+ VEC_iterate (tree, vbases, i, binfo); i++)
{
member_init_list
= tree_cons (binfo,
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 3a2f71ccaf7..6cbebb3abba 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -387,7 +387,7 @@ new_class_binding (tree name, tree value, tree type, cxx_scope *scope)
size_t i;
for (i = 0;
- (cb = VEC_iterate (cp_class_binding, scope->class_shadowed, i));
+ VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb);
i++)
{
cxx_binding **b;
@@ -1656,9 +1656,7 @@ print_binding_level (struct cp_binding_level* lvl)
cp_class_binding *b;
fprintf (stderr, " class-shadowed:");
for (i = 0;
- (b = VEC_iterate(cp_class_binding,
- lvl->class_shadowed,
- i));
+ VEC_iterate(cp_class_binding, lvl->class_shadowed, i, b);
++i)
fprintf (stderr, " %s ", IDENTIFIER_POINTER (b->identifier));
fprintf (stderr, "\n");
@@ -2617,7 +2615,7 @@ poplevel_class (void)
if (level->class_shadowed)
{
for (i = 0;
- (cb = VEC_iterate (cp_class_binding, level->class_shadowed, i));
+ VEC_iterate (cp_class_binding, level->class_shadowed, i, cb);
++i)
IDENTIFIER_BINDING (cb->identifier) = cb->base.previous;
ggc_free (level->class_shadowed);
@@ -4924,9 +4922,7 @@ store_class_bindings (VEC(cp_class_binding) *names,
cp_class_binding *cb;
timevar_push (TV_NAME_LOOKUP);
- for (i = 0;
- (cb = VEC_iterate(cp_class_binding, names, i));
- ++i)
+ for (i = 0; VEC_iterate(cp_class_binding, names, i, cb); ++i)
store_binding (cb->identifier, old_bindings);
timevar_pop (TV_NAME_LOOKUP);
}
@@ -4982,9 +4978,7 @@ push_to_top_level (void)
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
}
- for (i = 0;
- (sb = VEC_iterate (cxx_saved_binding, s->old_bindings, i));
- ++i)
+ for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, sb); ++i)
IDENTIFIER_MARKED (sb->identifier) = 0;
s->prev = scope_chain;
@@ -5015,9 +5009,7 @@ pop_from_top_level (void)
current_lang_base = 0;
scope_chain = s->prev;
- for (i = 0;
- (saved = VEC_iterate (cxx_saved_binding, s->old_bindings, i));
- ++i)
+ for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, saved); ++i)
{
tree id = saved->identifier;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b1d9de03cc0..4c059c11805 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1838,7 +1838,7 @@ check_explicit_specialization (tree declarator,
methods = CLASSTYPE_METHOD_VEC (ctype);
if (methods)
for (idx = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (ovl = VEC_iterate (tree, methods, idx));
+ VEC_iterate (tree, methods, idx, ovl);
++idx)
{
if (!DECL_CONV_FN_P (OVL_CURRENT (ovl)))
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index ceefa3cd05f..e172aa38553 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1319,8 +1319,7 @@ lookup_conversion_operator (tree class_type, tree type)
for (pass = 0; pass < 2; ++pass)
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (fn = VEC_iterate (tree, methods, i));
- ++i)
+ VEC_iterate (tree, methods, i, fn); ++i)
{
/* All the conversion operators come near the beginning of the
class. Therefore, if FN is not a conversion operator, there
@@ -1410,7 +1409,7 @@ lookup_fnfields_1 (tree type, tree name)
/* Skip the conversion operators. */
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (fn = VEC_iterate (tree, method_vec, i));
+ VEC_iterate (tree, method_vec, i, fn);
++i)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
break;
@@ -1442,9 +1441,7 @@ lookup_fnfields_1 (tree type, tree name)
}
}
else
- for (;
- (fn = VEC_iterate (tree, method_vec, i));
- ++i)
+ for (; VEC_iterate (tree, method_vec, i, fn); ++i)
{
#ifdef GATHER_STATISTICS
n_outer_fields_searched++;
@@ -1887,6 +1884,7 @@ get_pure_virtuals (tree type)
{
unsigned ix;
tree binfo;
+ VEC (tree) *vbases;
/* Clear the CLASSTYPE_PURE_VIRTUALS list; whatever is already there
is going to be overridden. */
@@ -1903,8 +1901,8 @@ get_pure_virtuals (tree type)
/* Put the pure virtuals in dfs order. */
CLASSTYPE_PURE_VIRTUALS (type) = nreverse (CLASSTYPE_PURE_VIRTUALS (type));
- for (ix = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++)
+ for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
+ VEC_iterate (tree, vbases, ix, binfo); ix++)
{
tree virtuals;
@@ -2078,12 +2076,12 @@ add_conversions (tree binfo, void *data)
return NULL_TREE;
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
- (tmp = VEC_iterate (tree, method_vec, i));
+ VEC_iterate (tree, method_vec, i, tmp);
++i)
{
tree name;
- if (!tmp || ! DECL_CONV_FN_P (OVL_CURRENT (tmp)))
+ if (!DECL_CONV_FN_P (OVL_CURRENT (tmp)))
break;
name = DECL_NAME (OVL_CURRENT (tmp));
@@ -2153,6 +2151,7 @@ dfs_check_overlap (tree empty_binfo, void *data)
{
struct overlap_info *oi = (struct overlap_info *) data;
tree binfo;
+
for (binfo = TYPE_BINFO (oi->compare_type);
;
binfo = BINFO_BASE_BINFO (binfo, 0))
@@ -2308,9 +2307,10 @@ binfo_for_vbase (tree base, tree t)
{
unsigned ix;
tree binfo;
+ VEC (tree) *vbases;
- for (ix = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), ix)); ix++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
+ VEC_iterate (tree, vbases, ix, binfo); ix++)
if (BINFO_TYPE (binfo) == base)
return binfo;
return NULL;
diff --git a/gcc/vec.h b/gcc/vec.h
index 6d78c832b24..bea438a82b8 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -39,6 +39,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
objects pointed to must be long lived, but when dealing with a
vector of objects, the source objects need not be.
+ There are both 'index' and 'iterate' accessors. The iterator
+ returns a boolean iteration condition and updates the iteration
+ variable passed by reference. Because the iterator will be
+ inlined, the address-of can be optimized away.
+
The vectors are implemented using the trailing array idiom, thus
they are not resizeable without changing the address of the vector
object itself. This means you cannot have variables or fields of
@@ -70,6 +75,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
element ordering 'ordered_remove', and one which does not
'unordered_remove'. The latter function copies the end element
into the removed slot, rather than invoke a memmove operation.
+
+ If you need to directly manipulate a vector, then the 'address'
+ accessor will return the address of the start of the vector. Also
+ the 'space' predicate will tell you whether there is spare capacity
+ in the vector. You will not normally need to use these two functions.
Vector types are defined using a DEF_VEC_x(TYPEDEF) macro, and
variables of vector type are declared using a VEC(TYPEDEF)
@@ -89,7 +99,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
if (VEC_length(tree,s->v)) { we have some contents }
VEC_safe_push(tree,s->v,decl); // append some decl onto the end
- for (ix = 0; (t = VEC_iterate(tree,s->v,ix)); ix++)
+ for (ix = 0; VEC_iterate(tree,s->v,ix,t); ix++)
{ do something with t }
*/
@@ -105,14 +115,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
Return the number of active elements in V. V can be NULL, in which
case zero is returned. */
-#define VEC_length(TDEF,V) (VEC_OP(TDEF,length)(V))
+
+#define VEC_length(TDEF,V) (VEC_OP(TDEF,length)(V))
/* Get the final element of the vector.
T VEC_T_last(VEC(T) *v); // Pointer
T *VEC_T_last(VEC(T) *v); // Object
Return the final element. If V is empty, abort. */
-#define VEC_last(TDEF,V) (VEC_OP(TDEF,last)(V))
+
+#define VEC_last(TDEF,V) (VEC_OP(TDEF,last)(V VEC_CHECK_INFO))
/* Index into vector
T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
@@ -120,25 +132,29 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
Return the IX'th element. If IX is outside the domain of V,
abort. */
-#define VEC_index(TDEF,V,I) (VEC_OP(TDEF,index)(V,I))
+
+#define VEC_index(TDEF,V,I) (VEC_OP(TDEF,index)(V,I VEC_CHECK_INFO))
/* Iterate over vector
- T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
- T *VEC_T_index(VEC(T) *v, size_t ix); // Object
+ int VEC_T_index(VEC(T) *v, size_t ix, T &ptr); // Pointer
+ int VEC_T_index(VEC(T) *v, size_t ix, T *&ptr); // Object
- Return the IX'th element or NULL. Use this to iterate over the
- elements of a vector as follows,
+ Return iteration condition and update PTR to point to the IX'th
+ element. At the end of iteration, sets PTR to NULL. Use this to
+ iterate over the elements of a vector as follows,
- for (ix = 0; (ptr = VEC_iterate(T,v,ix)); ix++)
+ for (ix = 0; VEC_iterate(T,v,ix,ptr); ix++)
continue; */
-#define VEC_iterate(TDEF,V,I) (VEC_OP(TDEF,iterate)(V,I))
+
+#define VEC_iterate(TDEF,V,I,P) (VEC_OP(TDEF,iterate)(V,I,&(P)))
/* Allocate new vector.
VEC(T) *VEC_T_alloc(int reserve);
Allocate a new vector with space for RESERVE objects. If RESERVE
is <= 0, a default number of slots are created. */
-#define VEC_alloc(TDEF,A) (VEC_OP(TDEF,alloc)(A MEM_STAT_INFO))
+
+#define VEC_alloc(TDEF,A) (VEC_OP(TDEF,alloc)(A MEM_STAT_INFO))
/* Use these to determine the required size and initialization of a
vector embedded within another structure (as the final member).
@@ -147,8 +163,22 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
void VEC_T_embedded_init(VEC(T) *v, int reserve);
These allow the caller to perform the memory allocation. */
-#define VEC_embedded_size(TDEF,A) (VEC_OP(TDEF,embedded_size)(A))
-#define VEC_embedded_init(TDEF,O,A) (VEC_OP(TDEF,embedded_init)(O,A))
+
+#define VEC_embedded_size(TDEF,A) (VEC_OP(TDEF,embedded_size)(A))
+#define VEC_embedded_init(TDEF,O,A) (VEC_OP(TDEF,embedded_init)(O,A))
+
+/* Determine if a vector has additional capacity.
+
+ int VEC_T_space (VEC(T) *v,int reserve)
+
+ If V has space for RESERVE additional entries, return non-zero. If
+ RESERVE is < 0, ensure there is at least one space slot. You
+ usually only need to use this if you are doing your own vector
+ reallocation, for instance on an embedded vector. This returns
+ non-zero in exactly the same circumstances that VEC_T_reserve
+ will. */
+
+#define VEC_space(TDEF,V,R) (VEC_OP(TDEF,space)(V,R))
/* Reserve space.
int VEC_T_reserve(VEC(T) *&v, int reserve);
@@ -160,6 +190,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
perform the usual exponential headroom increase. Note this can
cause V to be reallocated. Returns non-zero iff reallocation
actually occurred. */
+
#define VEC_reserve(TDEF,V,R) (VEC_OP(TDEF,reserve)(&(V),R MEM_STAT_INFO))
/* Push object with no reallocation
@@ -170,7 +201,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
filled in. For object vectors, the new value can be NULL, in which
case NO initialization is performed. Aborts if there is
insufficient space in the vector. */
-#define VEC_quick_push(TDEF,V,O) (VEC_OP(TDEF,quick_push)(V,O))
+
+#define VEC_quick_push(TDEF,V,O) \
+ (VEC_OP(TDEF,quick_push)(V,O VEC_CHECK_INFO))
/* Push object with reallocation
T *VEC_T_safe_push (VEC(T) *&v, T obj); // Pointer
@@ -179,7 +212,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
Push a new element onto the end, 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 V, if needed. */
-#define VEC_safe_push(TDEF,V,O) (VEC_OP(TDEF,safe_push)(&(V),O MEM_STAT_INFO))
+
+#define VEC_safe_push(TDEF,V,O) \
+ (VEC_OP(TDEF,safe_push)(&(V),O VEC_CHECK_INFO MEM_STAT_INFO))
/* Pop element off end
T VEC_T_pop (VEC(T) *v); // Pointer
@@ -187,13 +222,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
Pop the last element off the end. Returns the element popped, for
pointer vectors. */
-#define VEC_pop(TDEF,V) (VEC_OP(TDEF,pop)(V))
+
+#define VEC_pop(TDEF,V) (VEC_OP(TDEF,pop)(V VEC_CHECK_INFO))
/* Truncate to specific length
void VEC_T_truncate (VEC(T) *v, size_t len);
Set the length as specified. This is an O(1) operation. */
-#define VEC_truncate(TDEF,V,I) (VEC_OP(TDEF,truncate)(V,I))
+
+#define VEC_truncate(TDEF,V,I) \
+ (VEC_OP(TDEF,truncate)(V,I VEC_CHECK_INFO))
/* Replace element
T VEC_T_replace (VEC(T) *v, size_t ix, T val); // Pointer
@@ -204,7 +242,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
pointer to the new value. For object vectors the new value can be
NULL, in which case no overwriting of the slot is actually
performed. */
-#define VEC_replace(TDEF,V,I,O) (VEC_OP(TDEF,replace)(V,I,O))
+
+#define VEC_replace(TDEF,V,I,O) \
+ (VEC_OP(TDEF,replace)(V,I,O VEC_CHECK_INFO))
/* Insert object with no reallocation
T *VEC_T_quick_insert (VEC(T) *v, size_t ix, T val); // Pointer
@@ -214,7 +254,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
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. Aborts if there is insufficient space. */
-#define VEC_quick_insert(TDEF,V,I,O) (VEC_OP(TDEF,quick_insert)(V,I,O))
+
+#define VEC_quick_insert(TDEF,V,I,O) \
+ (VEC_OP(TDEF,quick_insert)(V,I,O VEC_CHECK_INFO))
/* Insert object with reallocation
T *VEC_T_safe_insert (VEC(T) *&v, size_t ix, T val); // Pointer
@@ -224,7 +266,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
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. */
-#define VEC_safe_insert(TDEF,V,I,O) (VEC_OP(TDEF,safe_insert)(&(V),I,O MEM_STAT_INFO))
+
+#define VEC_safe_insert(TDEF,V,I,O) \
+ (VEC_OP(TDEF,safe_insert)(&(V),I,O VEC_CHECK_INFO MEM_STAT_INFO))
/* Remove element retaining order
T VEC_T_ordered_remove (VEC(T) *v, size_t ix); // Pointer
@@ -233,7 +277,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
Remove an element from the IXth position of V. Ordering of
remaining elements is preserverd. For pointer vectors returns the
removed object. This is an O(N) operation due to a memmove. */
-#define VEC_ordered_remove(TDEF,V,I) (VEC_OP(TDEF,ordered_remove)(V,I))
+
+#define VEC_ordered_remove(TDEF,V,I) \
+ (VEC_OP(TDEF,ordered_remove)(V,I VEC_CHECK_INFO))
/* Remove element destroying order
T VEC_T_unordered_remove (VEC(T) *v, size_t ix); // Pointer
@@ -242,13 +288,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
Remove an element from the IXth position of V. Ordering of
remaining elements is destroyed. For pointer vectors returns the
removed object. This is an O(1) operation. */
-#define VEC_unordered_remove(TDEF,V,I) (VEC_OP(TDEF,unordered_remove)(V,I))
+
+#define VEC_unordered_remove(TDEF,V,I) \
+ (VEC_OP(TDEF,unordered_remove)(V,I VEC_CHECK_INFO))
/* Get the address of the array of elements
T *VEC_T_address (VEC(T) v)
If you need to directly manipulate the array (for instance, you
want to feed it to qsort), use this accessor. */
+
#define VEC_address(TDEF,V) (VEC_OP(TDEF,address)(V))
#if !IN_GENGTYPE
@@ -257,15 +306,20 @@ extern void *vec_p_reserve (void *, int MEM_STAT_DECL);
extern void *vec_o_reserve (void *, int, size_t, size_t MEM_STAT_DECL);
#if ENABLE_CHECKING
-extern void vec_assert_fail (const char *, const char *,
- const char *, unsigned int, const char *)
- ATTRIBUTE_NORETURN;
-#define VEC_ASSERT_FAIL(OP,VEC) \
- vec_assert_fail (OP,#VEC,__FILE__,__LINE__,__FUNCTION__)
+#define VEC_CHECK_INFO ,__FILE__,__LINE__,__FUNCTION__
+#define VEC_CHECK_DECL ,const char *file_,unsigned line_,const char *function_
+#define VEC_CHECK_PASS ,file_,line_,function_
#define VEC_ASSERT(EXPR,OP,TDEF) \
(void)((EXPR) ? 0 : (VEC_ASSERT_FAIL(OP,VEC(TDEF)), 0))
+
+extern void vec_assert_fail (const char *, const char * VEC_CHECK_DECL)
+ ATTRIBUTE_NORETURN;
+#define VEC_ASSERT_FAIL(OP,VEC) vec_assert_fail (OP,#VEC VEC_CHECK_PASS)
#else
+#define VEC_CHECK_INFO
+#define VEC_CHECK_DECL
+#define VEC_CHECK_PASS
#define VEC_ASSERT(EXPR,OP,TYPE) (void)(EXPR)
#endif
@@ -303,7 +357,7 @@ static inline size_t VEC_OP (TDEF,length) \
} \
\
static inline TDEF VEC_OP (TDEF,last) \
- (const VEC (TDEF) *vec_) \
+ (const VEC (TDEF) *vec_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && vec_->num, "last", TDEF); \
\
@@ -311,17 +365,26 @@ static inline TDEF VEC_OP (TDEF,last) \
} \
\
static inline TDEF VEC_OP (TDEF,index) \
- (const VEC (TDEF) *vec_, size_t ix_) \
+ (const VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \
\
return vec_->vec[ix_]; \
} \
\
-static inline TDEF VEC_OP (TDEF,iterate) \
- (const VEC (TDEF) *vec_, size_t ix_) \
+static inline int VEC_OP (TDEF,iterate) \
+ (const VEC (TDEF) *vec_, size_t ix_, TDEF *ptr) \
{ \
- return vec_ && ix_ < vec_->num ? vec_->vec[ix_] : NULL; \
+ if (vec_ && ix_ < vec_->num) \
+ { \
+ *ptr = vec_->vec[ix_]; \
+ return 1; \
+ } \
+ else \
+ { \
+ *ptr = 0; \
+ return 0; \
+ } \
} \
\
static inline VEC (TDEF) *VEC_OP (TDEF,alloc) \
@@ -343,11 +406,17 @@ static inline void VEC_OP (TDEF,embedded_init) \
vec_->alloc = alloc_; \
} \
\
+static inline int VEC_OP (TDEF,space) \
+ (VEC (TDEF) *vec_, int alloc_) \
+{ \
+ return vec_ ? ((vec_)->alloc - (vec_)->num \
+ < (size_t)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \
+} \
+ \
static inline int VEC_OP (TDEF,reserve) \
(VEC (TDEF) **vec_, int alloc_ MEM_STAT_DECL) \
{ \
- int extend = !*vec_ || ((*vec_)->alloc - (*vec_)->num \
- < (size_t)(alloc_ < 0 ? 1 : alloc_)); \
+ int extend = VEC_OP (TDEF,space) (*vec_, alloc_); \
\
if (extend) \
*vec_ = vec_p_reserve (*vec_, alloc_ PASS_MEM_STAT); \
@@ -356,7 +425,7 @@ static inline int VEC_OP (TDEF,reserve) \
} \
\
static inline TDEF *VEC_OP (TDEF,quick_push) \
- (VEC (TDEF) *vec_, TDEF obj_) \
+ (VEC (TDEF) *vec_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
@@ -368,15 +437,15 @@ static inline TDEF *VEC_OP (TDEF,quick_push) \
} \
\
static inline TDEF *VEC_OP (TDEF,safe_push) \
- (VEC (TDEF) **vec_, TDEF obj_ MEM_STAT_DECL) \
+ (VEC (TDEF) **vec_, TDEF obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
- return VEC_OP (TDEF,quick_push) (*vec_, obj_); \
+ return VEC_OP (TDEF,quick_push) (*vec_, obj_ VEC_CHECK_PASS); \
} \
\
static inline TDEF VEC_OP (TDEF,pop) \
- (VEC (TDEF) *vec_) \
+ (VEC (TDEF) *vec_ VEC_CHECK_DECL) \
{ \
TDEF obj_; \
\
@@ -387,7 +456,7 @@ static inline TDEF VEC_OP (TDEF,pop) \
} \
\
static inline void VEC_OP (TDEF,truncate) \
- (VEC (TDEF) *vec_, size_t size_) \
+ (VEC (TDEF) *vec_, size_t size_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \
if (vec_) \
@@ -395,7 +464,7 @@ static inline void VEC_OP (TDEF,truncate) \
} \
\
static inline TDEF VEC_OP (TDEF,replace) \
- (VEC (TDEF) *vec_, size_t ix_, TDEF obj_) \
+ (VEC (TDEF) *vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF old_obj_; \
\
@@ -407,7 +476,7 @@ static inline TDEF VEC_OP (TDEF,replace) \
} \
\
static inline TDEF *VEC_OP (TDEF,quick_insert) \
- (VEC (TDEF) *vec_, size_t ix_, TDEF obj_) \
+ (VEC (TDEF) *vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
@@ -421,15 +490,15 @@ static inline TDEF *VEC_OP (TDEF,quick_insert) \
} \
\
static inline TDEF *VEC_OP (TDEF,safe_insert) \
- (VEC (TDEF) **vec_, size_t ix_, TDEF obj_ MEM_STAT_DECL) \
+ (VEC (TDEF) **vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
- return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_); \
+ return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_ VEC_CHECK_PASS); \
} \
\
static inline TDEF VEC_OP (TDEF,ordered_remove) \
- (VEC (TDEF) *vec_, size_t ix_) \
+ (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
TDEF obj_; \
@@ -443,7 +512,7 @@ static inline TDEF VEC_OP (TDEF,ordered_remove) \
} \
\
static inline TDEF VEC_OP (TDEF,unordered_remove) \
- (VEC (TDEF) *vec_, size_t ix_) \
+ (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
TDEF obj_; \
@@ -480,7 +549,7 @@ static inline size_t VEC_OP (TDEF,length) \
} \
\
static inline TDEF *VEC_OP (TDEF,last) \
- (VEC (TDEF) *vec_) \
+ (VEC (TDEF) *vec_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && vec_->num, "last", TDEF); \
\
@@ -488,17 +557,26 @@ static inline TDEF *VEC_OP (TDEF,last) \
} \
\
static inline TDEF *VEC_OP (TDEF,index) \
- (VEC (TDEF) *vec_, size_t ix_) \
+ (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \
\
return &vec_->vec[ix_]; \
} \
\
-static inline TDEF *VEC_OP (TDEF,iterate) \
- (VEC (TDEF) *vec_, size_t ix_) \
+static inline int VEC_OP (TDEF,iterate) \
+ (VEC (TDEF) *vec_, size_t ix_, TDEF **ptr) \
{ \
- return vec_ && ix_ < vec_->num ? &vec_->vec[ix_] : NULL; \
+ if (vec_ && ix_ < vec_->num) \
+ { \
+ *ptr = &vec_->vec[ix_]; \
+ return 1; \
+ } \
+ else \
+ { \
+ *ptr = 0; \
+ return 0; \
+ } \
} \
\
static inline VEC (TDEF) *VEC_OP (TDEF,alloc) \
@@ -522,11 +600,17 @@ static inline void VEC_OP (TDEF,embedded_init) \
vec_->alloc = alloc_; \
} \
\
+static inline int VEC_OP (TDEF,space) \
+ (VEC (TDEF) *vec_, int alloc_) \
+{ \
+ return vec_ ? ((vec_)->alloc - (vec_)->num \
+ < (size_t)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \
+} \
+ \
static inline int VEC_OP (TDEF,reserve) \
(VEC (TDEF) **vec_, int alloc_ MEM_STAT_DECL) \
{ \
- int extend = !*vec_ || ((*vec_)->alloc - (*vec_)->num \
- < (size_t)(alloc_ < 0 ? 1 : alloc_)); \
+ int extend = VEC_OP (TDEF,space) (*vec_, alloc_); \
\
if (extend) \
*vec_ = vec_o_reserve (*vec_, alloc_, \
@@ -537,7 +621,7 @@ static inline int VEC_OP (TDEF,reserve) \
} \
\
static inline TDEF *VEC_OP (TDEF,quick_push) \
- (VEC (TDEF) *vec_, const TDEF *obj_) \
+ (VEC (TDEF) *vec_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
@@ -550,22 +634,22 @@ static inline TDEF *VEC_OP (TDEF,quick_push) \
} \
\
static inline TDEF *VEC_OP (TDEF,safe_push) \
- (VEC (TDEF) **vec_, const TDEF *obj_ MEM_STAT_DECL) \
+ (VEC (TDEF) **vec_, const TDEF *obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
- return VEC_OP (TDEF,quick_push) (*vec_, obj_); \
+ return VEC_OP (TDEF,quick_push) (*vec_, obj_ VEC_CHECK_PASS); \
} \
\
static inline void VEC_OP (TDEF,pop) \
- (VEC (TDEF) *vec_) \
+ (VEC (TDEF) *vec_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_->num, "pop", TDEF); \
--vec_->num; \
} \
\
static inline void VEC_OP (TDEF,truncate) \
- (VEC (TDEF) *vec_, size_t size_) \
+ (VEC (TDEF) *vec_, size_t size_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \
if (vec_) \
@@ -573,7 +657,7 @@ static inline void VEC_OP (TDEF,truncate) \
} \
\
static inline TDEF *VEC_OP (TDEF,replace) \
- (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_) \
+ (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
@@ -586,7 +670,7 @@ static inline TDEF *VEC_OP (TDEF,replace) \
} \
\
static inline TDEF *VEC_OP (TDEF,quick_insert) \
- (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_) \
+ (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
@@ -601,15 +685,15 @@ static inline TDEF *VEC_OP (TDEF,quick_insert) \
} \
\
static inline TDEF *VEC_OP (TDEF,safe_insert) \
- (VEC (TDEF) **vec_, size_t ix_, const TDEF *obj_ MEM_STAT_DECL) \
+ (VEC (TDEF) **vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
- return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_); \
+ return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_ VEC_CHECK_PASS); \
} \
\
static inline void VEC_OP (TDEF,ordered_remove) \
- (VEC (TDEF) *vec_, size_t ix_) \
+ (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
@@ -619,7 +703,7 @@ static inline void VEC_OP (TDEF,ordered_remove) \
} \
\
static inline void VEC_OP (TDEF,unordered_remove) \
- (VEC (TDEF) *vec_, size_t ix_) \
+ (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \
vec_->vec[ix_] = vec_->vec[--vec_->num]; \
OpenPOWER on IntegriCloud