gdb: remove TYPE_NFIELDS macro

Remove `TYPE_NFIELDS`, changing all the call sites to use
`type::num_fields` directly.  This is quite a big diff, but this was
mostly done using sed and coccinelle.  A few call sites were done by
hand.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_NFIELDS): Remove.  Change all cal sites to use
	type::num_fields instead.

Change-Id: Ib73be4c36f9e770e0f729bac3b5257d7cb2f9591
This commit is contained in:
Simon Marchi
2020-05-22 16:55:15 -04:00
parent 5e33d5f4e1
commit 1f704f761b
68 changed files with 322 additions and 318 deletions

View File

@ -1150,7 +1150,7 @@ typy_length (PyObject *self)
if (type == NULL)
return -1;
return TYPE_NFIELDS (type);
return type->num_fields ();
}
/* Implements boolean evaluation of gdb.Type. Handle this like other
@ -1193,7 +1193,7 @@ typy_getitem (PyObject *self, PyObject *key)
if (type == NULL)
return NULL;
for (i = 0; i < TYPE_NFIELDS (type); i++)
for (i = 0; i < type->num_fields (); i++)
{
const char *t_field_name = TYPE_FIELD_NAME (type, i);
@ -1251,7 +1251,7 @@ typy_has_key (PyObject *self, PyObject *args)
if (type == NULL)
return NULL;
for (i = 0; i < TYPE_NFIELDS (type); i++)
for (i = 0; i < type->num_fields (); i++)
{
const char *t_field_name = TYPE_FIELD_NAME (type, i);
@ -1336,7 +1336,7 @@ typy_iterator_iternext (PyObject *self)
typy_iterator_object *iter_obj = (typy_iterator_object *) self;
struct type *type = iter_obj->source->type;
if (iter_obj->field < TYPE_NFIELDS (type))
if (iter_obj->field < type->num_fields ())
{
gdbpy_ref<> result = make_fielditem (type, iter_obj->field,
iter_obj->kind);