public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Keith Seitz <keiths@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Compute proper length for dynamic types of TYPE_CODE_TYPEDEF
Date: Mon, 26 Jun 2017 11:01:00 -0000	[thread overview]
Message-ID: <8d848672-f348-08e6-f395-aa110cdc2f7d@redhat.com> (raw)
In-Reply-To: <1498265971-27536-1-git-send-email-keiths@redhat.com>

Hi Keith,

On 06/24/2017 01:59 AM, Keith Seitz wrote:
> --- a/gdb/testsuite/gdb.base/vla-datatypes.c
> +++ b/gdb/testsuite/gdb.base/vla-datatypes.c
> @@ -46,11 +46,12 @@ vla_factory (int n)
>    BAR             bar_vla[n];
>    int i;
>  
> -  struct vla_struct
> +  typedef struct vla_struct
>    {
>      int something;
>      int vla_field[n];
> -  } vla_struct_object;
> +  } vla_s;
> +  vla_s vla_struct_object;

This object is now defined with a typedef type, and that confused me a lot.
After staring at this for a while, I think you did intend that.  I just
find the naming very confusing.  Can we improve on that?  Maybe add
some comments too.

>  
>    struct inner_vla_struct
>    {
> @@ -59,14 +60,28 @@ vla_factory (int n)
>      int after;
>    } inner_vla_struct_object;
>  
> +  struct vla_typedef

... because this type is called "typedef", while
the above isn't.

> +  {
> +    int something;
> +    vla_s vla_object;
> +  } vla_typedef_struct_object;

... and this object here is not a a type that is 
defined as a typedef, while it's named "..._typedef_...".
So at first is looked like you have the "typedef vs non-typedef"
cases backwards.  I understand now that you're referring to
the "vla_object" member, but it was totally non-obvious to me.

Can we rename things a bit to avoid this confusion?

Maybe

  struct vla_typedef -> struct vla_s_struct_member
  union vla_typedef_union -> union vla_s_union_member

?

and add some comment about using "vla_s" throughout
because it's a typedef.  And/or rename it
to "vla_struct_typedef".

Thanks,
Pedro Alves

  reply	other threads:[~2017-06-26 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-24  0:59 Keith Seitz
2017-06-26 11:01 ` Pedro Alves [this message]
2020-06-10 11:35 Tom de Vries
2020-06-11 10:46 ` Pedro Alves
2020-06-11 12:38   ` Tom de Vries

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=8d848672-f348-08e6-f395-aa110cdc2f7d@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@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).