From: Paul Iannetta <piannetta@kalrayinc.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH v2] c++: parser - Support for target address spaces in C++
Date: Thu, 13 Oct 2022 17:14:03 +0200 [thread overview]
Message-ID: <20221013151403.uvbphivxbgsbzieh@ws2202.lin.mbt.kalray.eu> (raw)
In-Reply-To: <Y0emRu3pbDGdGhM7@tucnak>
On Thu, Oct 13, 2022 at 07:46:46AM +0200, Jakub Jelinek wrote:
> On Thu, Oct 13, 2022 at 02:52:59AM +0200, Paul Iannetta via Gcc-patches wrote:
> > + if (type != error_mark_node
> > + && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (type))
> > + && current_function_decl)
> > + {
> > + error
> > + ("compound literal qualified by address-space qualifier");
> > + type = error_mark_node;
>
> Can you please write this as:
> error ("compound literal qualified by address-space "
> "qualifier");
> ? That is how diagnostics that don't fit on one line are usually written.
>
> > @@ -23812,6 +23830,11 @@ cp_parser_cv_qualifier_seq_opt (cp_parser* parser)
> > break;
> > }
> >
> > + if (RID_FIRST_ADDR_SPACE <= token->keyword &&
>
> && should never go at the end of line.
>
> > + token->keyword <= RID_LAST_ADDR_SPACE)
> > + cv_qualifier =
>
> and similarly = (except for aggregate initializers).
>
> > + ENCODE_QUAL_ADDR_SPACE (token->keyword - RID_FIRST_ADDR_SPACE);
>
> So:
>
> if (RID_FIRST_ADDR_SPACE <= token->keyword
> && token->keyword <= RID_LAST_ADDR_SPACE)
> cv_qualifier
> = ENCODE_QUAL_ADDR_SPACE (token->keyword - RID_FIRST_ADDR_SPACE);
>
> > + int unified_cv =
> > + CLEAR_QUAL_ADDR_SPACE (arg_cv_quals & ~parm_cv_quals)
> > + | ENCODE_QUAL_ADDR_SPACE (as_common);
>
> Similarly (but this time with ()s added to ensure correct formatting in
> some editors).
>
> int unified_cv
> = (CLEAR_QUAL_ADDR_SPACE (arg_cv_quals & ~parm_cv_quals)
> | ENCODE_QUAL_ADDR_SPACE (as_common));
>
> > result_type
> > = cp_build_qualified_type (void_type_node,
> > - (cp_type_quals (TREE_TYPE (t1))
> > - | cp_type_quals (TREE_TYPE (t2))));
> > + (CLEAR_QUAL_ADDR_SPACE (cp_type_quals (TREE_TYPE (t1)))
> > + | CLEAR_QUAL_ADDR_SPACE (cp_type_quals (TREE_TYPE (t2)))
>
> The above 2 lines are way too long.
> I'd suggest to use temporaries, say
> int quals1 = cp_type_quals (TREE_TYPE (t1));
> int quals2 = cp_type_quals (TREE_TYPE (t2));
> and use those.
>
> Jakub
Thank you for the style review, I'll apply them in the next iteration.
Paul
next prev parent reply other threads:[~2022-10-13 15:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 14:34 [RFC] " Paul Iannetta
2022-10-06 17:34 ` Jason Merrill
2022-10-09 16:12 ` [PATCH] " Paul Iannetta
2022-10-10 19:20 ` Jason Merrill
2022-10-11 22:03 ` [PATCH v2] " Paul Iannetta
2022-10-12 1:49 ` Jason Merrill
2022-10-13 0:52 ` Paul Iannetta
2022-10-13 5:46 ` Jakub Jelinek
2022-10-13 15:14 ` Paul Iannetta [this message]
2022-10-13 15:02 ` Jason Merrill
2022-10-13 15:23 ` Paul Iannetta
2022-10-13 15:47 ` Jason Merrill
2022-10-13 16:02 ` Paul Iannetta
2022-10-13 19:41 ` Jason Merrill
2022-10-13 21:57 ` Paul Iannetta
2022-10-14 15:19 ` Jason Merrill
2022-10-18 7:37 ` [PATCH v3] " Paul Iannetta
2022-10-18 14:24 ` Jason Merrill
2022-10-18 17:01 ` Paul Iannetta
2022-10-19 18:55 ` Jason Merrill
2022-10-26 7:18 ` Paul Iannetta
2022-10-26 16:28 ` Jason Merrill
2022-11-10 15:42 ` [PATCH v4] " Paul Iannetta
2022-11-03 13:38 ` [PATCH v3] " Georg-Johann Lay
2022-11-10 14:08 ` Paul Iannetta
2022-11-10 16:40 ` Georg-Johann Lay
2022-11-14 17:55 ` Jason Merrill
2022-11-15 12:15 ` Georg-Johann Lay
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=20221013151403.uvbphivxbgsbzieh@ws2202.lin.mbt.kalray.eu \
--to=piannetta@kalrayinc.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--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).