public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Martin Sebor <msebor@gmail.com>,
	 Richard Biener <richard.guenther@gmail.com>,
	Richard Sandiford <richard.sandiford@arm.com>,
	 Jakub Jelinek <jakub@redhat.com>,
	Trevor Saunders <tbsaunde@tbsaunde.org>,
	 Segher Boessenkool <segher@kernel.crashing.org>
Subject: Re: [RFC/PATCH] Use range-based for loops for traversing loops
Date: Mon, 19 Jul 2021 15:08:38 +0100	[thread overview]
Message-ID: <CAH6eHdThayp6=UKYrcewkez7FpRgwZ9etQCFBoj=RKfX=zruYw@mail.gmail.com> (raw)
In-Reply-To: <0a8b77ba-1d54-1eff-b54d-d2cb1e769e09@linux.ibm.com>

On Mon, 19 Jul 2021 at 07:20, Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> This patch follows Martin's suggestion here[1], to support
> range-based for loops for traversing loops, analogously to
> the patch for vec[2].
>
> Bootstrapped and regtested on powerpc64le-linux-gnu P9,
> x86_64-redhat-linux and aarch64-linux-gnu, also
> bootstrapped on ppc64le P9 with bootstrap-O3 config.
>
> Any comments are appreciated.

In the loops_list::iterator type, this looks a little strange:

+    bool
+    operator!= (const iterator &rhs) const
+    {
+      return this->curr_idx < rhs.curr_idx;
+    }
+

This works fine when the iterator type is used implicitly in a
range-based for loop, but it wouldn't work for explicit uses of the
iterator type where somebody does the != comparison with the
past-the-end iterator on on the LHS:

auto&& list ALL_LOOPS(foo);
auto end = list.end();
auto begin = list.begin();
while (--end != begin)

  parent reply	other threads:[~2021-07-19 14:08 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19  6:20 Kewen.Lin
2021-07-19  6:26 ` Andrew Pinski
2021-07-20  8:56   ` Kewen.Lin
2021-07-19 14:08 ` Jonathan Wakely [this message]
2021-07-20  8:56   ` Kewen.Lin
2021-07-19 14:34 ` Richard Biener
2021-07-20  8:57   ` Kewen.Lin
2021-07-19 15:59 ` Martin Sebor
2021-07-20  8:58   ` Kewen.Lin
2021-07-20  9:49     ` Jonathan Wakely
2021-07-20  9:50       ` Jonathan Wakely
2021-07-20 14:42       ` Kewen.Lin
2021-07-20 14:36 ` [PATCH v2] " Kewen.Lin
2021-07-22 12:56   ` Richard Biener
2021-07-22 12:56     ` Richard Biener
2021-07-23  8:41     ` [PATCH] Make loops_list support an optional loop_p root Kewen.Lin
2021-07-23 16:26       ` Martin Sebor
2021-07-27  2:25         ` Kewen.Lin
2021-07-29  8:01       ` Richard Biener
2021-07-30  5:20         ` [PATCH v2] " Kewen.Lin
2021-08-03 12:08           ` Richard Biener
2021-08-04  2:36             ` [PATCH v3] " Kewen.Lin
2021-08-04 10:01               ` Richard Biener
2021-08-04 10:47                 ` Kewen.Lin
2021-08-04 12:04                   ` Richard Biener
2021-08-05  8:50                     ` Kewen.Lin
2021-07-23  8:35   ` [PATCH v3] Use range-based for loops for traversing loops Kewen.Lin
2021-07-23 16:10     ` Martin Sebor
2021-07-27  2:10       ` [PATCH v4] " Kewen.Lin
2021-07-29  7:48         ` Richard Biener
2021-07-30  7:18         ` Thomas Schwinge
2021-07-30  7:58           ` Kewen.Lin
2021-11-24 14:24             ` Reduce scope of a few 'class loop *loop' variables (was: [PATCH v4] Use range-based for loops for traversing loops) Thomas Schwinge
2021-11-24 16:58               ` Martin Jambor
2021-11-24 19:44               ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdThayp6=UKYrcewkez7FpRgwZ9etQCFBoj=RKfX=zruYw@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=linkw@linux.ibm.com \
    --cc=msebor@gmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.org \
    --cc=tbsaunde@tbsaunde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).