From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28828 invoked by alias); 23 Dec 2018 07:00:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 28809 invoked by uid 89); 23 Dec 2018 07:00:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=adapters, mechanical, ugly, readable X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Dec 2018 07:00:43 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id ECEF8117065; Sun, 23 Dec 2018 02:00:41 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Zw+YI9cmdWZP; Sun, 23 Dec 2018 02:00:41 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 5FF0C117062; Sun, 23 Dec 2018 02:00:41 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 8C71586763; Sun, 23 Dec 2018 11:00:33 +0400 (+04) Date: Sun, 23 Dec 2018 07:00:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 00/12] Remove some ALL_* iteration macros Message-ID: <20181223070033.GB8096@adacore.com> References: <20181125165439.13773-1-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181125165439.13773-1-tom@tromey.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2018-12/txt/msg00280.txt.bz2 > 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