diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 21 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 10 | ||||
-rw-r--r-- | gcc/cp/error.c | 2 | ||||
-rw-r--r-- | gcc/cp/except.c | 4 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 4 | ||||
-rw-r--r-- | gcc/cp/method.c | 2 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 20 | ||||
-rw-r--r-- | gcc/cp/parser.c | 34 | ||||
-rw-r--r-- | gcc/cp/pt.c | 21 | ||||
-rw-r--r-- | gcc/cp/repo.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 18 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 |
15 files changed, 75 insertions, 96 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 82c8299..719658d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2010-08-20 Nathan Froyd <froydnj@codesourcery.com> + + * call.c: Use FOR_EACH_VEC_ELT. + * class.c: Likewise. + * decl.c: Likewise. + * decl2.c: Likewise. + * error.c: Likewise. + * except.c: Likewise. + * mangle.c: Likewise. + * method.c: Likewise. + * name-lookup.c: Likewise. + * parser.c: Likewise. + * pt.c: Likewise. + * repo.c: Likewise. + * semantics.c: Likewise. + * typeck2.c: Likewise. + 2010-08-19 Jason Merrill <jason@redhat.com> * call.c (reference_related_p): Check for error_mark_node. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index adcf984..36f5a55 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3161,7 +3161,7 @@ resolve_args (VEC(tree,gc) *args) unsigned int ix; tree arg; - for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix) + FOR_EACH_VEC_ELT (tree, args, ix, arg) { if (error_operand_p (arg)) return NULL; @@ -5423,7 +5423,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum) } /* Detect recursion. */ - for (i = 0; VEC_iterate (tree, default_arg_context, i, t); ++i) + FOR_EACH_VEC_ELT (tree, default_arg_context, i, t) if (t == fn) { error ("recursive evaluation of default argument for %q#D", fn); @@ -5620,7 +5620,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ++nargs; alcarray = XALLOCAVEC (tree, nargs); alcarray[0] = first_arg; - for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix) + FOR_EACH_VEC_ELT (tree, args, ix, arg) alcarray[ix + 1] = arg; argarray = alcarray; } diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c00b7de..35b6db13 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2048,7 +2048,7 @@ get_vcall_index (tree fn, tree type) tree_pair_p p; unsigned ix; - for (ix = 0; VEC_iterate (tree_pair_s, indices, ix, p); ix++) + FOR_EACH_VEC_ELT (tree_pair_s, indices, ix, p) if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (p->purpose)) || same_signature_p (fn, p->purpose)) return p->value; @@ -8125,7 +8125,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid) signature as FN, then we do not need a second vcall offset. Check the list of functions already present in the derived class vtable. */ - for (i = 0; VEC_iterate (tree, vid->fns, i, derived_entry); ++i) + FOR_EACH_VEC_ELT (tree, vid->fns, i, derived_entry) { if (same_signature_p (derived_entry, orig_fn) /* We only use one vcall offset for virtual destructors, diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 198921f..6465658 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -720,9 +720,8 @@ poplevel (int keep, int reverse, int functionbody) /* Remove declarations for any `for' variables from inner scopes that we kept around. */ - for (ix = VEC_length (tree, current_binding_level->dead_vars_from_for) - 1; - VEC_iterate (tree, current_binding_level->dead_vars_from_for, ix, decl); - ix--) + FOR_EACH_VEC_ELT_REVERSE (tree, current_binding_level->dead_vars_from_for, + ix, decl) pop_binding (DECL_NAME (decl), decl); /* Restore the IDENTIFIER_TYPE_VALUEs. */ @@ -731,11 +730,9 @@ poplevel (int keep, int reverse, int functionbody) SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link), TREE_VALUE (link)); /* Restore the IDENTIFIER_LABEL_VALUEs for local labels. */ - for (ix = VEC_length (cp_label_binding, - current_binding_level->shadowed_labels) - 1; - VEC_iterate (cp_label_binding, current_binding_level->shadowed_labels, - ix, label_bind); - ix--) + FOR_EACH_VEC_ELT_REVERSE (cp_label_binding, + current_binding_level->shadowed_labels, + ix, label_bind) pop_local_label (label_bind->label, label_bind->prev_value); /* There may be OVERLOADs (wrapped in TREE_LISTs) on the BLOCK_VARs @@ -2712,7 +2709,7 @@ check_goto (tree decl) identified = true; } - for (ix = 0; VEC_iterate (tree, ent->bad_decls, ix, bad); ix++) + FOR_EACH_VEC_ELT (tree, ent->bad_decls, ix, bad) { int u = decl_jump_unsafe (bad); @@ -4598,9 +4595,7 @@ maybe_deduce_size_from_array_init (tree decl, tree init) VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (initializer); constructor_elt *ce; HOST_WIDE_INT i; - for (i = 0; - VEC_iterate (constructor_elt, v, i, ce); - ++i) + FOR_EACH_VEC_ELT (constructor_elt, v, i, ce) if (!check_array_designated_initializer (ce)) failure = 1; } @@ -12837,7 +12832,7 @@ finish_function (int flags) unsigned int i; tree decl; - for (i = 0; VEC_iterate (tree, deferred_mark_used_calls, i, decl); i++) + FOR_EACH_VEC_ELT (tree, deferred_mark_used_calls, i, decl) mark_used (decl); VEC_free (tree, gc, deferred_mark_used_calls); } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index fed3452..f233055 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3300,7 +3300,7 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority, /* Call the static storage duration function with appropriate arguments. */ - for (i = 0; VEC_iterate (tree, ssdf_decls, i, fndecl); ++i) + FOR_EACH_VEC_ELT (tree, ssdf_decls, i, fndecl) { /* Calls to pure or const functions will expand to nothing. */ if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE))) @@ -3742,7 +3742,7 @@ cp_write_global_declarations (void) /* Go through the set of inline functions whose bodies have not been emitted yet. If out-of-line copies of these functions are required, emit them. */ - for (i = 0; VEC_iterate (tree, deferred_fns, i, decl); ++i) + FOR_EACH_VEC_ELT (tree, deferred_fns, i, decl) { /* Does it need synthesizing? */ if (DECL_DEFAULTED_FN (decl) && ! DECL_INITIAL (decl) @@ -3844,7 +3844,7 @@ cp_write_global_declarations (void) reconsider = true; /* Static data members are just like namespace-scope globals. */ - for (i = 0; VEC_iterate (tree, pending_statics, i, decl); ++i) + FOR_EACH_VEC_ELT (tree, pending_statics, i, decl) { if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl) /* Don't write it out if we haven't seen a definition. */ @@ -3866,7 +3866,7 @@ cp_write_global_declarations (void) while (reconsider); /* All used inline functions must have a definition at this point. */ - for (i = 0; VEC_iterate (tree, deferred_fns, i, decl); ++i) + FOR_EACH_VEC_ELT (tree, deferred_fns, i, decl) { if (/* Check online inline functions that were actually used. */ DECL_ODR_USED (decl) && DECL_DECLARED_INLINE_P (decl) @@ -3888,7 +3888,7 @@ cp_write_global_declarations (void) } /* So must decls that use a type with no linkage. */ - for (i = 0; VEC_iterate (tree, no_linkage_decls, i, decl); ++i) + FOR_EACH_VEC_ELT (tree, no_linkage_decls, i, decl) if (!decl_defined_p (decl)) no_linkage_error (decl); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index cff822a..2bcc35b 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -304,7 +304,7 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames) parms = TREE_CHAIN (parms); } - for (i = 0; VEC_iterate (tree, typenames, i, t); ++i) + FOR_EACH_VEC_ELT (tree, typenames, i, t) { if (need_comma) pp_separate_with_comma (cxx_pp); diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 20b44e3..351e685 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1104,9 +1104,7 @@ perform_deferred_noexcept_checks (void) int i; pending_noexcept *p; location_t saved_loc = input_location; - for (i = 0; - VEC_iterate (pending_noexcept, pending_noexcept_checks, i, p); - ++i) + FOR_EACH_VEC_ELT (pending_noexcept, pending_noexcept_checks, i, p) { input_location = p->loc; maybe_noexcept_warning (p->fn); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index a47dfa8..03e2837 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -307,7 +307,7 @@ dump_substitution_candidates (void) tree el; fprintf (stderr, " ++ substitutions "); - for (i = 0; VEC_iterate (tree, G.substitutions, i, el); ++i) + FOR_EACH_VEC_ELT (tree, G.substitutions, i, el) { const char *name = "???"; @@ -387,7 +387,7 @@ add_substitution (tree node) int i; tree candidate; - for (i = 0; VEC_iterate (tree, G.substitutions, i, candidate); i++) + FOR_EACH_VEC_ELT (tree, G.substitutions, i, candidate) { gcc_assert (!(DECL_P (node) && node == candidate)); gcc_assert (!(TYPE_P (node) && TYPE_P (candidate) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index b9511f5..359e71d 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1204,7 +1204,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, if (diag) msg = ("virtual base %qT does not have a move constructor " "or trivial copy constructor"); - for (i = 0; VEC_iterate (tree, vbases, i, base_binfo); ++i) + FOR_EACH_VEC_ELT (tree, vbases, i, base_binfo) { if (copy_arg_p) argtype = build_stub_type (BINFO_TYPE (base_binfo), quals, move_p); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 800e340..af6cef4 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -327,9 +327,7 @@ new_class_binding (tree name, tree value, tree type, cxx_scope *scope) /* Fixup the current bindings, as they might have moved. */ size_t i; - for (i = 0; - VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb); - i++) + FOR_EACH_VEC_ELT (cp_class_binding, scope->class_shadowed, i, cb) { cxx_binding **b; b = &IDENTIFIER_BINDING (cb->identifier); @@ -1687,9 +1685,7 @@ print_binding_level (struct cp_binding_level* lvl) size_t i; cp_class_binding *b; fprintf (stderr, " class-shadowed:"); - for (i = 0; - VEC_iterate(cp_class_binding, lvl->class_shadowed, i, b); - ++i) + FOR_EACH_VEC_ELT (cp_class_binding, lvl->class_shadowed, i, b) fprintf (stderr, " %s ", IDENTIFIER_POINTER (b->identifier)); fprintf (stderr, "\n"); } @@ -2644,9 +2640,7 @@ poplevel_class (void) /* Remove the bindings for all of the class-level declarations. */ if (level->class_shadowed) { - for (i = 0; - VEC_iterate (cp_class_binding, level->class_shadowed, i, cb); - ++i) + FOR_EACH_VEC_ELT (cp_class_binding, level->class_shadowed, i, cb) IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; ggc_free (level->class_shadowed); level->class_shadowed = NULL; @@ -4048,7 +4042,7 @@ tree_vec_contains (VEC(tree,gc)* vec, tree target) { unsigned int i; tree elt; - for (i = 0; VEC_iterate(tree,vec,i,elt); ++i) + FOR_EACH_VEC_ELT (tree,vec,i,elt) if (elt == target) return true; return false; @@ -5001,7 +4995,7 @@ arg_assoc_args_vec (struct arg_lookup *k, VEC(tree,gc) *args) unsigned int ix; tree arg; - for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix) + FOR_EACH_VEC_ELT (tree, args, ix, arg) if (arg_assoc (k, arg)) return true; return false; @@ -5484,7 +5478,7 @@ push_to_top_level (void) SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t)); } - for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, sb); ++i) + FOR_EACH_VEC_ELT (cxx_saved_binding, s->old_bindings, i, sb) IDENTIFIER_MARKED (sb->identifier) = 0; s->prev = scope_chain; @@ -5521,7 +5515,7 @@ pop_from_top_level (void) current_lang_base = 0; scope_chain = s->prev; - for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, saved); ++i) + FOR_EACH_VEC_ELT (cxx_saved_binding, s->old_bindings, i, saved) { tree id = saved->identifier; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index dd6f04c..6c4fe1d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11187,14 +11187,10 @@ cp_parser_template_id (cp_parser *parser, access_check = check_value->checks; if (access_check) { - for (i = 0 ; - VEC_iterate (deferred_access_check, access_check, i, chk) ; - ++i) - { - perform_or_defer_access_check (chk->binfo, - chk->decl, - chk->diag_decl); - } + FOR_EACH_VEC_ELT (deferred_access_check, access_check, i, chk) + perform_or_defer_access_check (chk->binfo, + chk->decl, + chk->diag_decl); } /* Return the stored value. */ return check_value->value; @@ -16319,10 +16315,8 @@ cp_parser_class_specifier (cp_parser* parser) }; */ - for (ix = 0; - VEC_iterate (cp_default_arg_entry, unparsed_funs_with_default_args, - ix, e); - ix++) + FOR_EACH_VEC_ELT (cp_default_arg_entry, unparsed_funs_with_default_args, + ix, e) { fn = e->decl; /* If there are default arguments that have not yet been processed, @@ -16345,9 +16339,7 @@ cp_parser_class_specifier (cp_parser* parser) pop_scope (pushed_scope); VEC_truncate (cp_default_arg_entry, unparsed_funs_with_default_args, 0); /* Now parse the body of the functions. */ - for (ix = 0; - VEC_iterate (tree, unparsed_funs_with_definitions, ix, fn); - ix++) + FOR_EACH_VEC_ELT (tree, unparsed_funs_with_definitions, ix, fn) cp_parser_late_parsing_for_member (parser, fn); VEC_truncate (tree, unparsed_funs_with_definitions, 0); } @@ -20469,14 +20461,10 @@ cp_parser_pre_parsed_nested_name_specifier (cp_parser *parser) checks = check_value->checks; if (checks) { - for (i = 0 ; - VEC_iterate (deferred_access_check, checks, i, chk) ; - ++i) - { - perform_or_defer_access_check (chk->binfo, - chk->decl, - chk->diag_decl); - } + FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk) + perform_or_defer_access_check (chk->binfo, + chk->decl, + chk->diag_decl); } /* Set the scope from the stored value. */ parser->scope = check_value->value; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 02c54f9..759e22f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7735,11 +7735,9 @@ perform_typedefs_access_check (tree tmpl, tree targs) return; saved_location = input_location; - for (i = 0; - VEC_iterate (qualified_typedef_usage_t, + FOR_EACH_VEC_ELT (qualified_typedef_usage_t, get_types_needing_access_check (tmpl), - i, iter); - ++i) + i, iter) { tree type_decl = iter->typedef_decl; tree type_scope = iter->context; @@ -12799,7 +12797,7 @@ tsubst_copy_and_build (tree t, n = VEC_copy (constructor_elt, gc, CONSTRUCTOR_ELTS (t)); newlen = VEC_length (constructor_elt, n); - for (idx = 0; VEC_iterate (constructor_elt, n, idx, ce); idx++) + FOR_EACH_VEC_ELT (constructor_elt, n, idx, ce) { if (ce->index && process_index_p) ce->index = RECUR (ce->index); @@ -12833,8 +12831,7 @@ tsubst_copy_and_build (tree t, VEC(constructor_elt,gc) *old_n = n; n = VEC_alloc (constructor_elt, gc, newlen); - for (idx = 0; VEC_iterate (constructor_elt, old_n, idx, ce); - idx++) + FOR_EACH_VEC_ELT (constructor_elt, old_n, idx, ce) { if (TREE_CODE (ce->value) == TREE_VEC) { @@ -17923,7 +17920,7 @@ any_type_dependent_arguments_p (const VEC(tree,gc) *args) unsigned int i; tree arg; - for (i = 0; VEC_iterate (tree, args, i, arg); ++i) + FOR_EACH_VEC_ELT (tree, args, i, arg) { if (type_dependent_expression_p (arg)) return true; @@ -18359,7 +18356,7 @@ make_args_non_dependent (VEC(tree,gc) *args) unsigned int ix; tree arg; - for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix) + FOR_EACH_VEC_ELT (tree, args, ix, arg) { tree newarg = build_non_dependent_expr (arg); if (newarg != arg) @@ -18662,11 +18659,9 @@ append_type_to_template_for_access_check (tree templ, gcc_assert (type_decl && (TREE_CODE (type_decl) == TYPE_DECL)); /* Make sure we don't append the type to the template twice. */ - for (i = 0; - VEC_iterate (qualified_typedef_usage_t, + FOR_EACH_VEC_ELT (qualified_typedef_usage_t, get_types_needing_access_check (templ), - i, iter); - ++i) + i, iter) if (iter->typedef_decl == type_decl && scope == iter->context) return; diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index 2a08c8f..22d58af 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -267,9 +267,7 @@ finish_repo (void) fprintf (repo_file, "\n"); } - for (ix = VEC_length (tree, pending_repo) - 1; - VEC_iterate (tree, pending_repo, ix, val); - ix--) + FOR_EACH_VEC_ELT_REVERSE (tree, pending_repo, ix, val) { tree name = DECL_ASSEMBLER_NAME (val); char type = IDENTIFIER_REPO_CHOSEN (name) ? 'C' : 'O'; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 949e108..0afa8f9 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -232,14 +232,10 @@ pop_to_parent_deferring_access_checks (void) int i, j; deferred_access_check *chk, *probe; - for (i = 0 ; - VEC_iterate (deferred_access_check, checks, i, chk) ; - ++i) + FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk) { - for (j = 0 ; - VEC_iterate (deferred_access_check, - ptr->deferred_access_checks, j, probe) ; - ++j) + FOR_EACH_VEC_ELT (deferred_access_check, + ptr->deferred_access_checks, j, probe) { if (probe->binfo == chk->binfo && probe->decl == chk->decl && @@ -268,7 +264,7 @@ perform_access_checks (VEC (deferred_access_check,gc)* checks) if (!checks) return; - for (i = 0 ; VEC_iterate (deferred_access_check, checks, i, chk) ; ++i) + FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk) enforce_access (chk->binfo, chk->decl, chk->diag_decl); } @@ -323,10 +319,8 @@ perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl) } /* See if we are already going to perform this check. */ - for (i = 0 ; - VEC_iterate (deferred_access_check, - ptr->deferred_access_checks, i, chk) ; - ++i) + FOR_EACH_VEC_ELT (deferred_access_check, + ptr->deferred_access_checks, i, chk) { if (chk->decl == decl && chk->binfo == binfo && chk->diag_decl == diag_decl) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 59b9c40..b9c027a 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -412,7 +412,7 @@ abstract_virtuals_error (tree decl, tree type) " because the following virtual functions are pure within %qT:", type); - for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++) + FOR_EACH_VEC_ELT (tree, pure, ix, fn) inform (input_location, "\t%+#D", fn); /* Now truncate the vector. This leaves it non-null, so we know there are pure virtuals, but empty so we don't list them out @@ -1035,7 +1035,7 @@ process_init_constructor_array (tree type, tree init) if (!unbounded && VEC_length (constructor_elt, v) > len) error ("too many initializers for %qT", type); - for (i = 0; VEC_iterate (constructor_elt, v, i, ce); ++i) + FOR_EACH_VEC_ELT (constructor_elt, v, i, ce) { if (ce->index) { |