public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] coroutines: Use cp_build_init_expr consistently.
Date: Wed, 12 Oct 2022 07:34:45 +0100	[thread overview]
Message-ID: <B88FBC18-D1D1-48A1-BA6D-A2A69F4DB471@sandoe.co.uk> (raw)
In-Reply-To: <ace212c3-2e73-1c13-6fa8-48fad44ec787@redhat.com>



> On 12 Oct 2022, at 00:19, Jason Merrill <jason@redhat.com> wrote:
> 
> On 10/11/22 18:17, Iain Sandoe wrote:
>> Hi Jason
>>> On 11 Oct 2022, at 23:06, Jason Merrill <jason@redhat.com> wrote:
>>> 
>>> On 10/11/22 17:58, Iain Sandoe wrote:

>>>> Now we have the TARGET_EXPR_ELIDING_P flag, it is important to ensure it
>>>> is set properly on target exprs.  The code here has a mixture of APIs used
>>>> to build inits.  This patch changes that to use cp_build_init_expr() where
>>>> possible, since that handles setting the flag.
>>> 
>>> Hmm, I wouldn't expect this to be necessary, since cp_build_modify_expr calls cp_build_init_expr for INIT_EXPR.

You are, of course, right..

>>>  Perhaps the similarity of the function names is a trap...
>> not sure exactly what trap you mean.
> 
> The names are close, but cp_build_modify_expr is a lot more complicated; it handles conversions and overloaded operators.

This is one of the tricky parts about synthesizing AST from scratch - knowing which API is the “right one” to use in each case - e.g. here:  cp_build_modify_expr or  cp_build_init_expr or even build2 (INIT_EXPR..

So, it seems that where there could be a mismatch to be diagnosed, I should use cp_build_modify_expr, but maybe in some of the cases where there is no checking needed (e.g. set a guard var to true) it would be appropriate to use one of the simpler forms.

>> It seems that on my local set of additional tests (for some of the open prs) there are some
>> progressions from this change,

That’s a spurious observation, because cp_build_init_expr does not do the diagnostics.

patch withdrawn.
thanks for the explanations,
Iain


      reply	other threads:[~2022-10-12  6:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 21:58 Iain Sandoe
2022-10-11 22:06 ` Jason Merrill
2022-10-11 22:17   ` Iain Sandoe
2022-10-11 23:19     ` Jason Merrill
2022-10-12  6:34       ` Iain Sandoe [this message]

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=B88FBC18-D1D1-48A1-BA6D-A2A69F4DB471@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.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).