This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 00/12] Remove some ALL_* iteration macros
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 23 Dec 2018 11:00:33 +0400
- Subject: Re: [PATCH 00/12] Remove some ALL_* iteration macros
- References: <20181125165439.13773-1-tom@tromey.com>
> This series removes various ALL_* iteration macros, in favor of C++
> iterators, range adapters, and ranged for loops. I've been wanting
> this for a while, because it helps a little bit with various
> experiments of mine that involve changing objfile lifetime management;
> Pedro's thread iterator patch prompted me to finally do this.
>
> The main downside of removing these macros is that it involves some
> reindentation; and expanding some macros to two nested loops means a
> couple somewhat ugly reformattings.
>
> On the plus side, though, this tightens the scope of iteration
> variables, which is good. And, it removes some hairy code,
> particularly the ALL_OBJSECTIONS patch.
>
> There are still a few more such macros that could be converted. And,
> I think inf_threads_iterator could be converted to use next_iterator.
> I can do some of this if there's interest.
>
> Regression tested by the buildbot.
FWIW, this seems like a good change to me; I am particularly
receptive to the fact that the scope of the iteration variables
is now restricted to the loop itself.
As for the downside, I don't consider re-indentation a downside
other than it makes review a bit more painful. The two-nested
loop didn't seem like they were making the code less readable.
Did you have any other concerns with that?
I admit I was scanning the last few patches much faster than the first
few ones, but they seem fairly mechanical to me, so I think the risk
is low.
--
Joel