summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-22 16:55:14 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-22 16:55:14 -0400
commit5e33d5f4e1a5f2c3556ee31715ddc030d039b597 (patch)
treee58db956a72805d8a2a800cf0b913fd5808933ed
parent9392ebb3bbe4a43726ee8939c5447d88c7d3c1e4 (diff)
downloadbinutils-gdb-5e33d5f4e1a5f2c3556ee31715ddc030d039b597.tar.gz
gdb: add type::num_fields / type::set_num_fields
Add the `num_fields` and `set_num_fields` methods on `struct type`, in order to remove the `TYPE_NFIELDS` macro. In this patch, the `TYPE_NFIELDS` macro is changed to use `type::num_fields`, so all the call sites that are used to set the number of fields are changed to use `type::set_num_fields`. The next patch will remove `TYPE_NFIELDS` completely. I think that in the future, we should consider making the interface of `struct type` better. For example, right now it's possible for the number of fields property and the actual number of fields set to be out of sync. However, I want to keep the existing behavior in this patch, just translate from macros to methods. gdb/ChangeLog: * gdbtypes.h (struct type) <num_fields, set_num_fields>: New methods. (TYPE_NFIELDS): Use type::num_fields. Change all call sites that modify the number of fields to use type::set_num_fields instead. Change-Id: I5ad9de5be4097feaf942d111077434bf91d13dc5
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/ada-lang.c11
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/coffread.c12
-rw-r--r--gdb/ctfread.c4
-rw-r--r--gdb/dwarf2/read.c12
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/gdbtypes.c18
-rw-r--r--gdb/gdbtypes.h14
-rw-r--r--gdb/gnu-v3-abi.c4
-rw-r--r--gdb/mdebugread.c6
-rw-r--r--gdb/rust-lang.c2
-rw-r--r--gdb/stabsread.c8
-rw-r--r--gdb/windows-tdep.c2
14 files changed, 62 insertions, 43 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4662ff34923..9656bf907d9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-22 Simon Marchi <simon.marchi@efficios.com>
+
+ * gdbtypes.h (struct type) <num_fields, set_num_fields>: New
+ methods.
+ (TYPE_NFIELDS): Use type::num_fields. Change all call sites
+ that modify the number of fields to use type::set_num_fields
+ instead.
+
2020-05-22 Tom Tromey <tromey@adacore.com>
* compile/compile-object-load.h (munmap_list_free): Don't
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9f6485e04ab..a477f27797e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8021,7 +8021,6 @@ empty_record (struct type *templ)
struct type *type = alloc_type_copy (templ);
type->set_code (TYPE_CODE_STRUCT);
- TYPE_NFIELDS (type) = 0;
TYPE_FIELDS (type) = NULL;
INIT_NONE_SPECIFIC (type);
type->set_name ("<empty>");
@@ -8078,7 +8077,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
rtype = alloc_type_copy (type);
rtype->set_code (TYPE_CODE_STRUCT);
INIT_NONE_SPECIFIC (rtype);
- TYPE_NFIELDS (rtype) = nfields;
+ rtype->set_num_fields (nfields);
TYPE_FIELDS (rtype) = (struct field *)
TYPE_ALLOC (rtype, nfields * sizeof (struct field));
memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
@@ -8246,7 +8245,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
{
for (f = variant_field + 1; f < TYPE_NFIELDS (rtype); f += 1)
TYPE_FIELDS (rtype)[f - 1] = TYPE_FIELDS (rtype)[f];
- TYPE_NFIELDS (rtype) -= 1;
+ rtype->set_num_fields (rtype->num_fields () - 1);
}
else
{
@@ -8353,7 +8352,7 @@ template_to_static_fixed_type (struct type *type0)
TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0);
type->set_code (type0->code ());
INIT_NONE_SPECIFIC (type);
- TYPE_NFIELDS (type) = nfields;
+ type->set_num_fields (nfields);
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, nfields * sizeof (struct field));
memcpy (TYPE_FIELDS (type), TYPE_FIELDS (type0),
@@ -8402,7 +8401,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
rtype = alloc_type_copy (type);
rtype->set_code (TYPE_CODE_STRUCT);
INIT_NONE_SPECIFIC (rtype);
- TYPE_NFIELDS (rtype) = nfields;
+ rtype->set_num_fields (nfields);
TYPE_FIELDS (rtype) =
(struct field *) TYPE_ALLOC (rtype, nfields * sizeof (struct field));
memcpy (TYPE_FIELDS (rtype), TYPE_FIELDS (type),
@@ -8425,7 +8424,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
for (f = variant_field + 1; f < nfields; f += 1)
TYPE_FIELDS (rtype)[f - 1] = TYPE_FIELDS (rtype)[f];
- TYPE_NFIELDS (rtype) -= 1;
+ rtype->set_num_fields (rtype->num_fields () - 1);
}
else
{
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index b9bcc33080a..f66607cd736 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -271,7 +271,7 @@ buildsym_compunit::finish_block_internal
}
if (nparams > 0)
{
- TYPE_NFIELDS (ftype) = nparams;
+ ftype->set_num_fields (nparams);
TYPE_FIELDS (ftype) = (struct field *)
TYPE_ALLOC (ftype, nparams * sizeof (struct field));
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 0f7a6e3e5ad..2732421a35c 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1455,7 +1455,7 @@ patch_type (struct type *type, struct type *real_type)
int field_size = TYPE_NFIELDS (real_target) * sizeof (struct field);
TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
- TYPE_NFIELDS (target) = TYPE_NFIELDS (real_target);
+ target->set_num_fields (TYPE_NFIELDS (real_target));
TYPE_FIELDS (target) = (struct field *) TYPE_ALLOC (target,
field_size);
@@ -1883,7 +1883,7 @@ decode_base_type (struct coff_symbol *cs,
INIT_CPLUS_SPECIFIC (type);
TYPE_LENGTH (type) = 0;
TYPE_FIELDS (type) = 0;
- TYPE_NFIELDS (type) = 0;
+ type->set_num_fields (0);
}
else
{
@@ -1903,7 +1903,7 @@ decode_base_type (struct coff_symbol *cs,
INIT_CPLUS_SPECIFIC (type);
TYPE_LENGTH (type) = 0;
TYPE_FIELDS (type) = 0;
- TYPE_NFIELDS (type) = 0;
+ type->set_num_fields (0);
}
else
{
@@ -1924,7 +1924,7 @@ decode_base_type (struct coff_symbol *cs,
type->set_name (NULL);
TYPE_LENGTH (type) = 0;
TYPE_FIELDS (type) = 0;
- TYPE_NFIELDS (type) = 0;
+ type->set_num_fields (0);
}
else
{
@@ -2040,7 +2040,7 @@ coff_read_struct_type (int index, int length, int lastsym,
}
/* Now create the vector of fields, and record how big it is. */
- TYPE_NFIELDS (type) = nfields;
+ type->set_num_fields (nfields);
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * nfields);
@@ -2120,7 +2120,7 @@ coff_read_enum_type (int index, int length, int lastsym,
else /* Assume ints. */
TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
type->set_code (TYPE_CODE_ENUM);
- TYPE_NFIELDS (type) = nsyms;
+ type->set_num_fields (nsyms);
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * nsyms);
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index b5bdb5f9cf1..31f927e3bc9 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -308,7 +308,7 @@ attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
return;
/* Record the field count, allocate space for the array of fields. */
- TYPE_NFIELDS (type) = nfields;
+ type->set_num_fields (nfields);
TYPE_FIELDS (type)
= (struct field *) TYPE_ZALLOC (type, sizeof (struct field) * nfields);
@@ -1139,7 +1139,7 @@ add_stt_func (struct ctf_context *ccp, unsigned long idx)
ftype = get_tid_type (ccp->of, tid);
if (finfo.ctc_flags & CTF_FUNC_VARARG)
TYPE_VARARGS (ftype) = 1;
- TYPE_NFIELDS (ftype) = argc;
+ ftype->set_num_fields (argc);
/* If argc is 0, it has a "void" type. */
if (argc != 0)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ded71f53b59..975227ea7a2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9362,7 +9362,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* Smash this type to be a structure type. We have to do this
because the type has already been recorded. */
type->set_code (TYPE_CODE_STRUCT);
- TYPE_NFIELDS (type) = 3;
+ type->set_num_fields (3);
/* Save the field we care about. */
struct field saved_field = TYPE_FIELD (type, 0);
TYPE_FIELDS (type)
@@ -9461,7 +9461,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
memcpy (new_fields + 1, TYPE_FIELDS (type),
TYPE_NFIELDS (type) * sizeof (struct field));
TYPE_FIELDS (type) = new_fields;
- TYPE_NFIELDS (type) = TYPE_NFIELDS (type) + 1;
+ type->set_num_fields (TYPE_NFIELDS (type) + 1);
/* Install the discriminant at index 0 in the union. */
TYPE_FIELD (type, 0) = *disr_field;
@@ -9509,7 +9509,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
struct type *sub_type = TYPE_FIELD_TYPE (type, i);
if (TYPE_NFIELDS (sub_type) > 0)
{
- --TYPE_NFIELDS (sub_type);
+ sub_type->set_num_fields (sub_type->num_fields () - 1);
++TYPE_FIELDS (sub_type);
}
TYPE_FIELD_NAME (type, i) = variant_name;
@@ -14804,7 +14804,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
/* Record the field count, allocate space for the array of fields,
and create blank accessibility bitfields if necessary. */
- TYPE_NFIELDS (type) = nfields;
+ type->set_num_fields (nfields);
TYPE_FIELDS (type) = (struct field *)
TYPE_ZALLOC (type, sizeof (struct field) * nfields);
@@ -15933,7 +15933,7 @@ update_enumeration_type_from_children (struct die_info *die,
if (!fields.empty ())
{
- TYPE_NFIELDS (type) = fields.size ();
+ type->set_num_fields (fields.size ());
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * fields.size ());
memcpy (TYPE_FIELDS (type), fields.data (),
@@ -17084,7 +17084,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
}
/* Allocate storage for parameters and fill them in. */
- TYPE_NFIELDS (ftype) = nparams;
+ ftype->set_num_fields (nparams);
TYPE_FIELDS (ftype) = (struct field *)
TYPE_ZALLOC (ftype, nparams * sizeof (struct field));
diff --git a/gdb/eval.c b/gdb/eval.c
index ea086027880..023b629c1aa 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -682,7 +682,7 @@ fake_method::fake_method (type_instance_flags flags,
neither an objfile nor a gdbarch. As a result we must manually
allocate memory for auxiliary fields, and free the memory ourselves
when we are done with it. */
- TYPE_NFIELDS (type) = num_types;
+ type->set_num_fields (num_types);
TYPE_FIELDS (type) = (struct field *)
xzalloc (sizeof (struct field) * num_types);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 68d4c0c4a24..f42657ab8f9 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -562,7 +562,7 @@ lookup_function_type_with_arguments (struct type *type,
TYPE_PROTOTYPED (fn) = 1;
}
- TYPE_NFIELDS (fn) = nparams;
+ fn->set_num_fields (nparams);
TYPE_FIELDS (fn)
= (struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field));
for (i = 0; i < nparams; ++i)
@@ -1281,7 +1281,7 @@ create_array_type_with_stride (struct type *result_type,
result_type->set_code (TYPE_CODE_ARRAY);
TYPE_TARGET_TYPE (result_type) = element_type;
- TYPE_NFIELDS (result_type) = 1;
+ result_type->set_num_fields (1);
TYPE_FIELDS (result_type) =
(struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
TYPE_INDEX_TYPE (result_type) = range_type;
@@ -1380,7 +1380,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
result_type = alloc_type_copy (domain_type);
result_type->set_code (TYPE_CODE_SET);
- TYPE_NFIELDS (result_type) = 1;
+ result_type->set_num_fields (1);
TYPE_FIELDS (result_type)
= (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
@@ -1550,7 +1550,7 @@ smash_to_method_type (struct type *type, struct type *self_type,
TYPE_TARGET_TYPE (type) = to_type;
set_type_self_type (type, self_type);
TYPE_FIELDS (type) = args;
- TYPE_NFIELDS (type) = nargs;
+ type->set_num_fields (nargs);
if (varargs)
TYPE_VARARGS (type) = 1;
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
@@ -2402,8 +2402,8 @@ compute_variant_fields (struct type *type,
for (const auto &part : parts)
compute_variant_fields_inner (type, addr_stack, part, flags);
- TYPE_NFIELDS (resolved_type) = std::count (flags.begin (), flags.end (),
- true);
+ resolved_type->set_num_fields
+ (std::count (flags.begin (), flags.end (), true));
TYPE_FIELDS (resolved_type)
= (struct field *) TYPE_ALLOC (resolved_type,
TYPE_NFIELDS (resolved_type)
@@ -5558,7 +5558,7 @@ arch_flags_type (struct gdbarch *gdbarch, const char *name, int bit)
type = arch_type (gdbarch, TYPE_CODE_FLAGS, bit, name);
TYPE_UNSIGNED (type) = 1;
- TYPE_NFIELDS (type) = 0;
+ type->set_num_fields (0);
/* Pre-allocate enough space assuming every field is one bit. */
TYPE_FIELDS (type)
= (struct field *) TYPE_ZALLOC (type, bit * sizeof (struct field));
@@ -5587,7 +5587,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
TYPE_FIELD_TYPE (type, field_nr) = field_type;
SET_FIELD_BITPOS (TYPE_FIELD (type, field_nr), start_bitpos);
TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
- ++TYPE_NFIELDS (type);
+ type->set_num_fields (type->num_fields () + 1);
}
/* Special version of append_flags_type_field to add a flag field.
@@ -5630,7 +5630,7 @@ append_composite_type_field_raw (struct type *t, const char *name,
{
struct field *f;
- TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
+ t->set_num_fields (TYPE_NFIELDS (t) + 1);
TYPE_FIELDS (t) = XRESIZEVEC (struct field, TYPE_FIELDS (t),
TYPE_NFIELDS (t));
f = &(TYPE_FIELDS (t)[TYPE_NFIELDS (t) - 1]);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ba8e6f837aa..da8d5e2a119 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -901,6 +901,18 @@ struct type
this->main_type->name = name;
}
+ /* Get the number of fields of this type. */
+ int num_fields () const
+ {
+ return this->main_type->nfields;
+ }
+
+ /* Set the number of fields of this type. */
+ void set_num_fields (int num_fields)
+ {
+ this->main_type->nfields = num_fields;
+ }
+
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
@@ -1446,7 +1458,7 @@ extern unsigned type_align (struct type *);
space in struct type. */
extern bool set_type_align (struct type *, ULONGEST);
-#define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
+#define TYPE_NFIELDS(thistype) ((thistype)->num_fields ())
#define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
#define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index df5818b300e..b0544319383 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -165,7 +165,7 @@ build_gdb_vtable_type (struct gdbarch *arch)
gdb_assert (field == (field_list + 4));
t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL);
- TYPE_NFIELDS (t) = field - field_list;
+ t->set_num_fields (field - field_list);
TYPE_FIELDS (t) = field_list;
t->set_name ("gdb_gnu_v3_abi_vtable");
INIT_CPLUS_SPECIFIC (t);
@@ -1054,7 +1054,7 @@ build_std_type_info_type (struct gdbarch *arch)
gdb_assert (field == (field_list + 2));
t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL);
- TYPE_NFIELDS (t) = field - field_list;
+ t->set_num_fields (field - field_list);
TYPE_FIELDS (t) = field_list;
t->set_name ("gdb_gnu_v3_type_info");
INIT_CPLUS_SPECIFIC (t);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 9ad9c664bcb..1b499ccad34 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1017,7 +1017,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
t->set_code (type_code);
TYPE_LENGTH (t) = sh->value;
- TYPE_NFIELDS (t) = nfields;
+ t->set_num_fields (nfields);
TYPE_FIELDS (t) = f = ((struct field *)
TYPE_ALLOC (t,
nfields * sizeof (struct field)));
@@ -1186,7 +1186,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
{
struct block_iterator iter;
- TYPE_NFIELDS (ftype) = nparams;
+ ftype->set_num_fields (nparams);
TYPE_FIELDS (ftype) = (struct field *)
TYPE_ALLOC (ftype, nparams * sizeof (struct field));
@@ -1733,7 +1733,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
/* Deal with range types. */
if (t->bt == btRange)
{
- TYPE_NFIELDS (tp) = 0;
+ tp->set_num_fields (0);
TYPE_RANGE_DATA (tp) = ((struct range_bounds *)
TYPE_ZALLOC (tp, sizeof (struct range_bounds)));
TYPE_LOW_BOUND (tp) = AUX_GET_DNLOW (bigend, ax);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 2c76762eff2..f0bea374ecb 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -984,7 +984,7 @@ rust_composite_type (struct type *original,
result->set_code (TYPE_CODE_STRUCT);
result->set_name (name);
- TYPE_NFIELDS (result) = nfields;
+ result->set_num_fields (nfields);
TYPE_FIELDS (result)
= (struct field *) TYPE_ZALLOC (result, nfields * sizeof (struct field));
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index a632856404b..c3da9a239b4 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1009,7 +1009,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
TYPE_FIELD_TYPE (ftype, nparams) = ptype;
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
}
- TYPE_NFIELDS (ftype) = nparams;
+ ftype->set_num_fields (nparams);
TYPE_PROTOTYPED (ftype) = 1;
}
break;
@@ -1850,7 +1850,7 @@ again:
for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
TYPE_FIELD_TYPE (func_type, i) = t->type;
}
- TYPE_NFIELDS (func_type) = num_args;
+ func_type->set_num_fields (num_args);
TYPE_PROTOTYPED (func_type) = 1;
type = func_type;
@@ -3308,7 +3308,7 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
non-public fields. Record the field count, allocate space for the
array of fields, and create blank visibility bitfields if necessary. */
- TYPE_NFIELDS (type) = nfields;
+ type->set_num_fields (nfields);
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * nfields);
memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nfields);
@@ -3654,7 +3654,7 @@ read_enum_type (const char **pp, struct type *type,
TYPE_STUB (type) = 0;
if (unsigned_enum)
TYPE_UNSIGNED (type) = 1;
- TYPE_NFIELDS (type) = nsyms;
+ type->set_num_fields (nsyms);
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * nsyms);
memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nsyms);
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 20a18e6b683..d7c498f2e93 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -751,7 +751,7 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name,
int i;
type = arch_type (gdbarch, TYPE_CODE_ENUM, bit, name);
- TYPE_NFIELDS (type) = count;
+ type->set_num_fields (count);
TYPE_FIELDS (type) = (struct field *)
TYPE_ZALLOC (type, sizeof (struct field) * count);
TYPE_UNSIGNED (type) = 1;