This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove CHECK_TYPEDEF, use check_typedef instead
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches <gdb-patches at sourceware dot org>
- Date: Sat, 11 Jul 2015 08:18:17 -0500
- Subject: Re: [PATCH] Remove CHECK_TYPEDEF, use check_typedef instead
- Authentication-results: sourceware.org; auth=none
- References: <1436213157-21480-1-git-send-email-simon dot marchi at ericsson dot com> <559BFB12 dot 6050606 at redhat dot 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.