From: Jason Merrill <jason@redhat.com>
To: Anthony Sharp <anthonysharp15@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: private inheritance access diagnostics fix [PR17314]
Date: Fri, 22 Jan 2021 16:18:42 -0500 [thread overview]
Message-ID: <5255efef-0df8-a172-2064-1b1050b36909@redhat.com> (raw)
In-Reply-To: <CA+Lh_A=2jU8Q+x+K=iQBobTNb8rgm47XxLjnFb+NPO8BNEYmOg@mail.gmail.com>
On 1/22/21 3:07 PM, Anthony Sharp wrote:
> Hi Jason,
>
> Thanks for getting back to me so quickly.
>
> > Why two gcc-comit-mklog? That would generate the log entries twice.
>
> It did in fact generate the log entries twice, but I deleted out the
> second copy. Perhaps it would have made more sense to do git commit
> --amend instead.
>
> > Instead of making access_in_type non-static, let's defiine
> > get_parent_with_private_access in search.c and declare it in cp-tree.h
> > (with the declarations of nearby search.c functions).
>
> Done.
>
> > Only one 'n' in inaccessible.
>
> Oops!
>
> Subsequent lines of a comment should be indented to line up with the
> first line. This applies to all your multi-line comments.
>
>
> My bad, hopefully fixed now.
>
> Don't change the indentation of these blocks; in the GNU coding style
> the { } are indented two spaces from the if.
>
>
> I think I see what you mean; I forgot to indent the { } (and therefore
> also everything within it, by two spaces). Hopefully fixed.
>
> The new line of arguments should be indented to line up with the
> first one.
>
>
> Fixed I think.
>
> Please find attached the latest patch version with all these changes.
> git gcc-verify returns no problems and check_GNU_style.sh returns only
> false positives. Source builds fine. To be super safe I re-cloned the
> source and did git apply with the patch and it built and worked just
> fine, and hopefully I haven't missed anything.
>
> Thanks again for your help.
> Subject: [PATCH] This patch fixes PR17314. Previously, when class C attempted
> to access member a declared in class A through class B, where class B
> privately inherits from A and class C inherits from B, GCC would correctly
> report an access violation, but would erroneously report that the reason was
> because a was "protected", when in fact, from the point of view of class C,
> it was really "private". This patch updates the diagnostics code to generate
> more correct errors in cases of failed inheritance such as these.
The first line of the commit message should be the subject line for the
patch, i.e. "c++: private inheritance access diagnostics fix [PR17314]",
then a blank line, then the rationale.
> + if (parent_binfo != NULL_TREE
> + && context_for_name_lookup (decl)
> + != BINFO_TYPE (parent_binfo))
Here you want parens around the second != expression and its != token
aligned with "context"
> + complain_about_access (decl, diag_decl, diag_location, true,
> + parent_access);
...
> + complain_about_access (afi.get_decl (), afi.get_diag_decl (),
> + afi.get_diag_decl (), false, ak_none);
In both these calls, the second line is indented one space too far.
Jason
next prev parent reply other threads:[~2021-01-22 21:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 14:24 Anthony Sharp
2021-01-07 21:01 ` Jason Merrill
2021-01-09 0:38 ` Anthony Sharp
2021-01-11 20:03 ` Jason Merrill
2021-01-21 19:28 ` Anthony Sharp
2021-01-21 22:56 ` Jason Merrill
2021-01-22 3:44 ` Jason Merrill
2021-01-22 20:07 ` Anthony Sharp
2021-01-22 21:18 ` Jason Merrill [this message]
2021-01-22 22:36 ` Anthony Sharp
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=5255efef-0df8-a172-2064-1b1050b36909@redhat.com \
--to=jason@redhat.com \
--cc=anthonysharp15@gmail.com \
--cc=gcc-patches@gcc.gnu.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).