From: Jason Merrill <jason@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])
Date: Wed, 03 Aug 2016 21:53:00 -0000 [thread overview]
Message-ID: <CADzB+2kcqjHNxk80MJN_iPY-KcR5mhx-3DLV2R=bdhkSWW9rvw@mail.gmail.com> (raw)
In-Reply-To: <57A252B1.6050901@gmail.com>
On Wed, Aug 3, 2016 at 4:23 PM, Martin Sebor <msebor@gmail.com> wrote:
> On 08/03/2016 02:01 PM, Jason Merrill wrote:
>> On Wed, Aug 3, 2016 at 3:10 PM, Martin Sebor <msebor@gmail.com> wrote:
>>>>>>
>>>>>> Do you have ideas about how to improve the naming? Perhaps change
>>>>>> TYPE_ANONYMOUS_P to TYPE_NO_LINKAGE_NAME?
>>>>>
>>>>> I haven't thought about changing names but TYPE_NO_LINKAGE_NAME
>>>>> seems better than TYPE_ANONYMOUS_P.
>>>>
>>>> Or perhaps TYPE_UNNAMED_P.
>>>
>>> TYPE_UNNAMED_P would work but it wouldn't be a replacement for
>>> TYPE_ANONYMOUS_P.
>>>
>>> It sounds like TYPE_ANONYMOUS_P is the right name and the problem
>>> is that the value it returns isn't accurate until the full context
>>> to which it applies has been seen.
>>
>> I think you're thinking of ANON_AGGR_TYPE_P, which identifies
>> anonymous structs/unions; TYPE_ANONYMOUS_P identifies unnamed classes.
>
> Doh! You're right. I let the name confuse me again. Clearly
> TYPE_ANONYMOUS_P isn't the best name since it doesn't correspond
> to the C/C++ concept of an anonymous struct or union. TYPE_UNNAMED
> would be better (the same can be said about the C++ diagnostics that
> refer to unnamed structs as <anonymous struct>.)
I'll make this change; sorry for the merge conflict it will cause.
>>> I wonder if the right solution to this class of problems (which
>>> are probably unavoidable in the front end as the tree is being
>>> constructed), is to design an API that prevents using these
>>> "unreliable" queries until they can return a reliable result.
>>
>> It would be possible to change ANON_AGGR_TYPE_P to require
>> COMPLETE_TYPE_P, but a lot of uses will need to be adjusted to avoid
>> crashing.
>
> No, crashing shouldn't happen. It shouldn't be possible to call
> the function unless/until the node that represents the concept
> has been fully constructed. Using C++ syntax:
>
> void foo (tree *t)
> {
> if (ANONYMOUS_STRUCT *anon = dynamic_cast<ANONYMOUS_STRUCT*>(t))
> anon->function_only_defined_in_anonymous_struct ();
> }
>
> I was hoping something like this was close to what someone (Andrew?)
> has been working on.
I think for a while he was working on changing trees to use
inheritance rather than a discriminated union, but don't think he is
anymore.
Jason
prev parent reply other threads:[~2016-08-03 21:53 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 19:14 Martin Sebor
2016-07-23 17:18 ` Martin Sebor
2016-07-26 18:53 ` Jason Merrill
2016-07-29 23:22 ` Martin Sebor
2016-07-31 16:28 ` Jason Merrill
2016-07-31 20:27 ` Martin Sebor
2016-08-01 14:22 ` Jason Merrill
2016-08-02 21:00 ` Martin Sebor
2016-08-02 22:26 ` Jason Merrill
2016-08-03 2:13 ` Martin Sebor
2016-08-03 18:05 ` Jason Merrill
2016-09-14 17:05 ` Martin Sebor
2016-09-16 18:40 ` Jason Merrill
2016-09-20 17:12 ` Martin Sebor
2016-09-21 20:55 ` Jason Merrill
2016-09-22 23:57 ` Martin Sebor
2016-09-23 18:05 ` Jason Merrill
2016-10-05 21:43 ` Martin Sebor
2016-10-06 2:26 ` Jason Merrill
2016-10-06 20:29 ` Martin Sebor
2016-10-12 1:46 ` PING " Martin Sebor
2016-10-12 13:43 ` Jason Merrill
2016-10-13 22:40 ` Martin Sebor
2016-08-03 19:10 ` Martin Sebor
2016-08-03 20:02 ` Jason Merrill
2016-08-03 20:23 ` Martin Sebor
2016-08-03 21:53 ` Jason Merrill [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='CADzB+2kcqjHNxk80MJN_iPY-KcR5mhx-3DLV2R=bdhkSWW9rvw@mail.gmail.com' \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=msebor@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).