This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,c++] convert cp_parser.unparsed_function_queues &co. to VECs
On Tue, Jun 08, 2010 at 08:30:55AM -0700, Mark Mitchell wrote:
> Nathan Froyd wrote:
> > - for (TREE_PURPOSE (parser->unparsed_functions_queues)
> > - = nreverse (TREE_PURPOSE (parser->unparsed_functions_queues));
> > - (queue_entry = TREE_PURPOSE (parser->unparsed_functions_queues));
> > - TREE_PURPOSE (parser->unparsed_functions_queues)
> > - = TREE_CHAIN (TREE_PURPOSE (parser->unparsed_functions_queues)))
> > + for (ix = 0;
> > + VEC_iterate (cp_default_arg_entry, unparsed_funs_with_default_args,
> > + ix, e);
> > + ix++)
>
> Does this still iterate through things in the same order? That's
> important, IIRC. I couldn't quite follow the changes to build up and
> iterate through these lists, but would you please double-check? If you
> do need to reverse the iteration, that's an obvious change; just post
> the final patch after check-in.
That's a good question. In fact, I couldn't follow things either the
first time I wrote the patch and iterated from len-1..0. When testing
that version, however, there were testsuite failures in testcases
dealing with default arguments.
In pictures, before this change, we accumulated things:
.. -> C -> B -> A
and then reversed them to iterate:
A -> B -> C -> ...
But now we accumulate in the "correct" order:
[A, B, C, ...]
so there's no need to do the reversal.
Thanks for the review, will check in after trunk unfreezes.
-Nathan