Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@ericsson.com>,
	gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Remove CHECK_TYPEDEF, use check_typedef instead
Date: Sat, 11 Jul 2015 13:19:00 -0000	[thread overview]
Message-ID: <CADPb22SjePg2g8kn+u7tGNN2u8xxTStd-cvtQxd6BaPJ6MjWYw@mail.gmail.com> (raw)
In-Reply-To: <559BFB12.6050606@redhat.com>

On Tue, Jul 7, 2015 at 11:15 AM, Pedro Alves <palves@redhat.com> wrote:
> ...
> Or even rename it while at it:
>
>  void
>  peel_typedefs (struct type **type)
>  {
>    *type = check_typedef (*type);
>  }
>
> And so you'd write:
>
>  > -      CHECK_TYPEDEF (result);
>  > +      peel_typedefs (&result);
>
> Then the code ends up self documenting, and there's no way to
> forget to assign the return of the function back to the
> argument.

Hi.

If we get into renaming, it would be really nice to fix another
problem with check_typedefs.
Many don't know (or forget) that it actually serves (at least) two
main purposes.
The first is the obvious removal of typedefs.
The second is the resolution of opaque types.
Forgetting the second purpose has caused bugs in the past,
and just makes the code harder to read than it should be.

btw, a third potential use down the road is the completion
of reading in of debug info for types being read in lazily.
I know of at least one patch that looked at this,
and check_typedefs is the obvious place to do this.

I'm not advocating for a really_long_function_name_that_mentions_all_actions,
just pointing out that the current situation is lacking.
Something like "resolve_type" might work for me,
but I haven't put too much time into it.


  parent reply	other threads:[~2015-07-11 13:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 20:06 Simon Marchi
2015-07-07 13:20 ` Joel Brobecker
2015-07-07 16:15 ` Pedro Alves
2015-07-07 20:15   ` Simon Marchi
2015-07-07 22:01     ` Pedro Alves
2015-07-11 13:19   ` Doug Evans [this message]
2015-07-11 18:32     ` Pedro Alves
2015-07-11 22:52       ` Doug Evans
2015-07-14  9:34         ` Pedro Alves
2015-07-14 20:42           ` Simon Marchi
2015-07-13 17:18     ` Simon Marchi

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=CADPb22SjePg2g8kn+u7tGNN2u8xxTStd-cvtQxd6BaPJ6MjWYw@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@ericsson.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