This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove CHECK_TYPEDEF, use check_typedef instead


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]