[PATCH 4/4] gdb: remove TYPE_FIELDS macro

Tom Tromey tom@tromey.com
Fri May 22 20:23:49 GMT 2020


>>>>> "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?


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.

Anyway this looks good.

Tom


More information about the Gdb-patches mailing list