[PATCH 4/4] gdb: remove TYPE_FIELDS macro

Simon Marchi simark@simark.ca
Fri May 22 20:58:12 GMT 2020


On 2020-05-22 4:23 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> Remove all uses of the `TYPE_FIELDS` macro.  Replace them with either:
> Simon> 1) type::fields, to obtain a pointer to the fields array (same as
> Simon>    TYPE_FIELDS yields)
> 
> Simon> 2) type::field, a new convenience method that obtains a reference to one
> Simon>    of the type's field by index.  It is meant to replace
> Simon>      TYPE_FIELDS (type)[idx]
> 
> I suppose a future patch will remove the TYPE_FIELD macro?

Hmm right, it would have made sense to have a patch for that in this series... too bad, I'll
just send it separately.

> Simon> -  TYPE_FIELDS (type) = (struct field *)
> Simon> -    TYPE_ZALLOC (type, sizeof (struct field) * count);
> Simon> +  type->set_fields
> Simon> +    ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * count));
> Simon>    TYPE_UNSIGNED (type) = 1;
>  
> Technically I suppose this should be in the earlier patch.

Hmm yes, otherwise the previous commit wouldn't build.  Thanks for checking,
I've fixed, made sure that all commits built fine with --enable-targets=all
and pushed the series.

Simon



More information about the Gdb-patches mailing list