From: Martin Sebor <msebor@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jeff Law <law@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] make function_args_iterator a proper iterator
Date: Mon, 19 Nov 2018 15:36:00 -0000 [thread overview]
Message-ID: <ec0cf190-7310-dcbb-1fa5-f3c8bbf79803@gmail.com> (raw)
In-Reply-To: <CAFiYyc1SD7fzU4=B=2b5yJOZpNom-sQnc91oeiXJGDKRnYCi=Q@mail.gmail.com>
On 11/19/2018 03:32 AM, Richard Biener wrote:
> On Sat, Nov 17, 2018 at 12:05 AM Martin Sebor <msebor@gmail.com> wrote:
>>
>> To encourage and simplify the adoption of iterator classes in
>> GCC the attached patch turns the function_args_iterator struct
>> into an (almost) proper C++ iterator class that can be used
>> the same way as traditional forward iterators.
>>
>> The patch also replaces all of the 26 uses of the legacy
>> FOREACH_FUNCTION_ARGS macro with ordinary for loops that use
>> function_args_iterator directly, and also poisons both
>> FOREACH_FUNCTION_ARGS and the unused FOREACH_FUNCTION_ARGS_PTR
>> macros.
>>
>> The few dozen (hundred?) existing uses of for loops that iterate
>> over function parameter types using the TREE_CHAIN() macro can
>> be relatively easily modified to adopt the iterator approach over
>> time. (The patch stops of short of making this change.)
>>
>> Eventually, when GCC moves to more a recent C++ revision, it will
>> become possible to simplify the for loops to make use of the range
>> based for loop syntax along the lines of:
>>
>> for (auto argtype: function_args (functype))
>> {
>> ...
>> }
>>
>> Tested on x86_64-linux, and (lightly) on powerpc64le-linux using
>> a cross-compiler. I'll test the changes to the other back ends
>> before committing.
>
> This isn't stage3 material.
In the response referenced below Jeff requested I make use of
iterators in my patch. This simply does what he asked for,
except throughout all of GCC.
Martin
>
> Richard.
>
>>
>> Martin
>>
>> PS For some additional background on this change see:
>> https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00493.html
next prev parent reply other threads:[~2018-11-19 15:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 23:05 Martin Sebor
2018-11-19 10:33 ` Richard Biener
2018-11-19 15:36 ` Martin Sebor [this message]
2018-11-20 9:21 ` Richard Biener
2018-11-20 15:28 ` Martin Sebor
2018-11-29 4:40 ` Jeff Law
2018-11-19 10:48 ` Eric Botcazou
2018-11-19 15:57 ` Martin Sebor
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=ec0cf190-7310-dcbb-1fa5-f3c8bbf79803@gmail.com \
--to=msebor@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=richard.guenther@gmail.com \
/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).