2002-05-13 Daniel Jacobowitz <drow@mvista.com>

* ax-gdb.c (gen_sign_extend, gen_fetch, gen_usual_unary)
        (gen_cast, gen_scale, gen_add, gen_sub, gen_binop, gen_deref)
        (gen_address_of, gen_struct_ref, gen_repeat): Use type
        access macros.
        * c-typeprint.c (cp_type_print_method_args): Likewise.
        (c_type_print_args): Likewise.
        * d10v-tdep.c (d10v_push_arguments): Likewise.
        (d10v_extract_return_value): Likewise.
        * expprint.c (print_subexp): Likewise.
        * gdbtypes.c (lookup_primitive_typename): Likewise.
        (lookup_template_type, add_mangled_type, print_arg_types): Likewise.
        * gdbtypes.h (TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB)
        (TYPE_TARGET_STUB, TYPE_STATIC, TYPE_CONST, TYPE_VOLATILE)
        (TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_CODE_SPACE, TYPE_VARARGS)
        (TYPE_VECTOR): Likewise.
        * hpread.c (hpread_read_struct_type)
        (fix_static_member_physnames, fixup_class_method_type)
        (hpread_type_lookup): Likewise.
        * mdebugread.c (parse_symbol, parse_type): Likewise.
        * p-lang.c (is_pascal_string_type): Likewise.
        * valops.c (hand_function_call): Likewise.
        * x86-64-tdep.c (classify_argument): Likewise.

        * hpread.c (hpread_read_function_type)
        (hpread_read_doc_function_type): Call replace_type.
        * dstread.c (create_new_type): Delete.
        (decode_dst_structure, process_dst_function): Call alloc_type.
        Use type access macros.
This commit is contained in:
Daniel Jacobowitz 2002-05-13 14:00:36 +00:00
parent 8395426148
commit 0004e5a2cf
12 changed files with 115 additions and 90 deletions

View file

@ -1,3 +1,34 @@
2002-05-13 Daniel Jacobowitz <drow@mvista.com>
* ax-gdb.c (gen_sign_extend, gen_fetch, gen_usual_unary)
(gen_cast, gen_scale, gen_add, gen_sub, gen_binop, gen_deref)
(gen_address_of, gen_struct_ref, gen_repeat): Use type
access macros.
* c-typeprint.c (cp_type_print_method_args): Likewise.
(c_type_print_args): Likewise.
* d10v-tdep.c (d10v_push_arguments): Likewise.
(d10v_extract_return_value): Likewise.
* expprint.c (print_subexp): Likewise.
* gdbtypes.c (lookup_primitive_typename): Likewise.
(lookup_template_type, add_mangled_type, print_arg_types): Likewise.
* gdbtypes.h (TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB)
(TYPE_TARGET_STUB, TYPE_STATIC, TYPE_CONST, TYPE_VOLATILE)
(TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_CODE_SPACE, TYPE_VARARGS)
(TYPE_VECTOR): Likewise.
* hpread.c (hpread_read_struct_type)
(fix_static_member_physnames, fixup_class_method_type)
(hpread_type_lookup): Likewise.
* mdebugread.c (parse_symbol, parse_type): Likewise.
* p-lang.c (is_pascal_string_type): Likewise.
* valops.c (hand_function_call): Likewise.
* x86-64-tdep.c (classify_argument): Likewise.
* hpread.c (hpread_read_function_type)
(hpread_read_doc_function_type): Call replace_type.
* dstread.c (create_new_type): Delete.
(decode_dst_structure, process_dst_function): Call alloc_type.
Use type access macros.
2002-05-12 Mark Kettenis <kettenis@gnu.org>
* i387-tdep.c (i387_supply_fxsave): Skip the SSE registers if

View file

@ -353,7 +353,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
{
/* Do we need to sign-extend this? */
if (!TYPE_UNSIGNED (type))
ax_ext (ax, type->length * TARGET_CHAR_BIT);
ax_ext (ax, TYPE_LENGTH (type) * TARGET_CHAR_BIT);
}
@ -363,7 +363,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
static void
gen_extend (struct agent_expr *ax, struct type *type)
{
int bits = type->length * TARGET_CHAR_BIT;
int bits = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
/* I just had to. */
((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, bits));
}
@ -381,7 +381,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
ax_trace_quick (ax, TYPE_LENGTH (type));
}
switch (type->code)
switch (TYPE_CODE (type))
{
case TYPE_CODE_PTR:
case TYPE_CODE_ENUM:
@ -389,7 +389,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
case TYPE_CODE_CHAR:
/* It's a scalar value, so we know how to dereference it. How
many bytes long is it? */
switch (type->length)
switch (TYPE_LENGTH (type))
{
case 8 / TARGET_CHAR_BIT:
ax_simple (ax, aop_ref8);
@ -699,7 +699,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
the stack. Should we tweak the type? */
/* Some types require special handling. */
switch (value->type->code)
switch (TYPE_CODE (value->type))
{
/* Functions get converted to a pointer to the function. */
case TYPE_CODE_FUNC:
@ -874,7 +874,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
/* Dereference typedefs. */
type = check_typedef (type);
switch (type->code)
switch (TYPE_CODE (type))
{
case TYPE_CODE_PTR:
/* It's implementation-defined, and I'll bet this is what GCC
@ -925,9 +925,9 @@ gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
{
struct type *element = TYPE_TARGET_TYPE (type);
if (element->length != 1)
if (TYPE_LENGTH (element) != 1)
{
ax_const_l (ax, element->length);
ax_const_l (ax, TYPE_LENGTH (element));
ax_simple (ax, op);
}
}
@ -943,8 +943,8 @@ gen_add (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2, char *name)
{
/* Is it INT+PTR? */
if (value1->type->code == TYPE_CODE_INT
&& value2->type->code == TYPE_CODE_PTR)
if (TYPE_CODE (value1->type) == TYPE_CODE_INT
&& TYPE_CODE (value2->type) == TYPE_CODE_PTR)
{
/* Swap the values and proceed normally. */
ax_simple (ax, aop_swap);
@ -955,8 +955,8 @@ gen_add (struct agent_expr *ax, struct axs_value *value,
}
/* Is it PTR+INT? */
else if (value1->type->code == TYPE_CODE_PTR
&& value2->type->code == TYPE_CODE_INT)
else if (TYPE_CODE (value1->type) == TYPE_CODE_PTR
&& TYPE_CODE (value2->type) == TYPE_CODE_INT)
{
gen_scale (ax, aop_mul, value1->type);
ax_simple (ax, aop_add);
@ -966,8 +966,8 @@ gen_add (struct agent_expr *ax, struct axs_value *value,
/* Must be number + number; the usual binary conversions will have
brought them both to the same width. */
else if (value1->type->code == TYPE_CODE_INT
&& value2->type->code == TYPE_CODE_INT)
else if (TYPE_CODE (value1->type) == TYPE_CODE_INT
&& TYPE_CODE (value2->type) == TYPE_CODE_INT)
{
ax_simple (ax, aop_add);
gen_extend (ax, value1->type); /* Catch overflow. */
@ -989,10 +989,10 @@ static void
gen_sub (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2)
{
if (value1->type->code == TYPE_CODE_PTR)
if (TYPE_CODE (value1->type) == TYPE_CODE_PTR)
{
/* Is it PTR - INT? */
if (value2->type->code == TYPE_CODE_INT)
if (TYPE_CODE (value2->type) == TYPE_CODE_INT)
{
gen_scale (ax, aop_mul, value1->type);
ax_simple (ax, aop_sub);
@ -1003,7 +1003,7 @@ gen_sub (struct agent_expr *ax, struct axs_value *value,
/* Is it PTR - PTR? Strictly speaking, the types ought to
match, but this is what the normal GDB expression evaluator
tests for. */
else if (value2->type->code == TYPE_CODE_PTR
else if (TYPE_CODE (value2->type) == TYPE_CODE_PTR
&& (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type))
== TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type))))
{
@ -1018,8 +1018,8 @@ an integer nor a pointer of the same type.");
}
/* Must be number + number. */
else if (value1->type->code == TYPE_CODE_INT
&& value2->type->code == TYPE_CODE_INT)
else if (TYPE_CODE (value1->type) == TYPE_CODE_INT
&& TYPE_CODE (value2->type) == TYPE_CODE_INT)
{
ax_simple (ax, aop_sub);
gen_extend (ax, value1->type); /* Catch overflow. */
@ -1044,8 +1044,8 @@ gen_binop (struct agent_expr *ax, struct axs_value *value,
enum agent_op op_unsigned, int may_carry, char *name)
{
/* We only handle INT op INT. */
if ((value1->type->code != TYPE_CODE_INT)
|| (value2->type->code != TYPE_CODE_INT))
if ((TYPE_CODE (value1->type) != TYPE_CODE_INT)
|| (TYPE_CODE (value2->type) != TYPE_CODE_INT))
error ("Illegal combination of types in %s.", name);
ax_simple (ax,
@ -1092,7 +1092,7 @@ gen_deref (struct agent_expr *ax, struct axs_value *value)
{
/* The caller should check the type, because several operators use
this, and we don't know what error message to generate. */
if (value->type->code != TYPE_CODE_PTR)
if (TYPE_CODE (value->type) != TYPE_CODE_PTR)
internal_error (__FILE__, __LINE__,
"gen_deref: expected a pointer");
@ -1102,7 +1102,7 @@ gen_deref (struct agent_expr *ax, struct axs_value *value)
T" to "T", and mark the value as an lvalue in memory. Leave it
to the consumer to actually dereference it. */
value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
value->kind = ((value->type->code == TYPE_CODE_FUNC)
value->kind = ((TYPE_CODE (value->type) == TYPE_CODE_FUNC)
? axs_rvalue : axs_lvalue_memory);
}
@ -1114,7 +1114,7 @@ gen_address_of (struct agent_expr *ax, struct axs_value *value)
/* Special case for taking the address of a function. The ANSI
standard describes this as a special case, too, so this
arrangement is not without motivation. */
if (value->type->code == TYPE_CODE_FUNC)
if (TYPE_CODE (value->type) == TYPE_CODE_FUNC)
/* The value's already an rvalue on the stack, so we just need to
change the type. */
value->type = lookup_pointer_type (value->type);
@ -1346,7 +1346,7 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value, char *field,
/* Follow pointers until we reach a non-pointer. These aren't the C
semantics, but they're what the normal GDB evaluator does, so we
should at least be consistent. */
while (value->type->code == TYPE_CODE_PTR)
while (TYPE_CODE (value->type) == TYPE_CODE_PTR)
{
gen_usual_unary (ax, value);
gen_deref (ax, value);
@ -1410,7 +1410,7 @@ gen_repeat (union exp_element **pc, struct agent_expr *ax,
if (!v)
error ("Right operand of `@' must be a constant, in agent expressions.");
if (v->type->code != TYPE_CODE_INT)
if (TYPE_CODE (v->type) != TYPE_CODE_INT)
error ("Right operand of `@' must be an integer.");
length = value_as_long (v);
if (length <= 0)

View file

@ -158,7 +158,7 @@ cp_type_print_method_args (struct type **args, char *prefix, char *varstring,
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered ("(", stream);
if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
if (args && args[!staticp] && TYPE_CODE (args[!staticp]) != TYPE_CODE_VOID)
{
i = !staticp; /* skip the class variable */
while (1)
@ -169,7 +169,7 @@ cp_type_print_method_args (struct type **args, char *prefix, char *varstring,
fprintf_filtered (stream, " ...");
break;
}
else if (args[i]->code != TYPE_CODE_VOID)
else if (TYPE_CODE (args[i]) != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ", ");
}
@ -346,7 +346,7 @@ c_type_print_args (struct type *type, struct ui_file *stream)
{
fprintf_filtered (stream, "...");
}
else if ((args[1]->code == TYPE_CODE_VOID) &&
else if ((TYPE_CODE (args[1]) == TYPE_CODE_VOID) &&
(current_language->la_language == language_cplus))
{
fprintf_filtered (stream, "void");
@ -354,7 +354,7 @@ c_type_print_args (struct type *type, struct ui_file *stream)
else
{
for (i = 1;
args[i] != NULL && args[i]->code != TYPE_CODE_VOID;
args[i] != NULL && TYPE_CODE (args[i]) != TYPE_CODE_VOID;
i++)
{
c_print_type (args[i], "", stream, -1, 0);
@ -362,7 +362,7 @@ c_type_print_args (struct type *type, struct ui_file *stream)
{
fprintf_filtered (stream, "...");
}
else if (args[i + 1]->code != TYPE_CODE_VOID)
else if (TYPE_CODE (args[i + 1]) != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ",");
wrap_here (" ");

View file

@ -1037,7 +1037,7 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
struct type *type = check_typedef (VALUE_TYPE (arg));
char *contents = VALUE_CONTENTS (arg);
int len = TYPE_LENGTH (type);
/* printf ("push: type=%d len=%d\n", type->code, len); */
/* printf ("push: type=%d len=%d\n", TYPE_CODE (type), len); */
{
int aligned_regnum = (regnum + 1) & ~1;
if (len <= 2 && regnum <= ARGN_REGNUM)
@ -1091,7 +1091,7 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES],
char *valbuf)
{
int len;
/* printf("RET: TYPE=%d len=%d r%d=0x%x\n",type->code, TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */
/* printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */
{
len = TYPE_LENGTH (type);
if (len == 1)

View file

@ -705,17 +705,6 @@ dst_sym_addr (dst_sect_ref_t *ref)
+ ref->sect_offset;
}
static struct type *
create_new_type (struct objfile *objfile)
{
struct type *type;
type = (struct type *)
obstack_alloc (&objfile->symbol_obstack, sizeof (struct type));
memset (type, 0, sizeof (struct type));
return type;
}
static struct symbol *
create_new_symbol (struct objfile *objfile, char *name)
{
@ -865,7 +854,7 @@ decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code,
xfree (name);
return type;
}
type = create_new_type (objfile);
type = alloc_type (objfile);
TYPE_NAME (type) = obstack_copy0 (&objfile->symbol_obstack,
name, strlen (name));
xfree (name);
@ -1306,10 +1295,10 @@ process_dst_function (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
if (!type->function_type)
{
ftype = create_new_type (objfile);
ftype = alloc_type (objfile);
type->function_type = ftype;
ftype->target_type = type;
ftype->code = TYPE_CODE_FUNC;
TYPE_TARGET_TYPE (ftype) = type;
TYPE_CODE (ftype) = TYPE_CODE_FUNC;
}
SYMBOL_TYPE (sym) = type->function_type;

View file

@ -334,7 +334,7 @@ print_subexp (register struct expression *exp, register int *pos,
(*pos) += 2;
if ((int) prec > (int) PREC_PREFIX)
fputs_filtered ("(", stream);
if (exp->elts[pc + 1].type->code == TYPE_CODE_FUNC &&
if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC &&
exp->elts[pc + 3].opcode == OP_LONG)
{
/* We have a minimal symbol fn, probably. It's encoded

View file

@ -936,7 +936,7 @@ lookup_primitive_typename (char *name)
for (p = current_language->la_builtin_type_vector; *p != NULL; p++)
{
if (STREQ ((**p)->name, name))
if (STREQ (TYPE_NAME (**p), name))
{
return (**p);
}
@ -1081,10 +1081,10 @@ struct type *
lookup_template_type (char *name, struct type *type, struct block *block)
{
struct symbol *sym;
char *nam = (char *) alloca (strlen (name) + strlen (type->name) + 4);
char *nam = (char *) alloca (strlen (name) + strlen (TYPE_NAME (type)) + 4);
strcpy (nam, name);
strcat (nam, "<");
strcat (nam, type->name);
strcat (nam, TYPE_NAME (type));
strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
sym = lookup_symbol (nam, block, VAR_NAMESPACE, 0, (struct symtab **) NULL);
@ -1511,8 +1511,8 @@ add_mangled_type (struct extra *pextras, struct type *t)
complain (&msg, tcode);
}
}
if (t->target_type)
add_mangled_type (pextras, t->target_type);
if (TYPE_TARGET_TYPE (t))
add_mangled_type (pextras, TYPE_TARGET_TYPE (t));
}
#if 0
@ -2713,7 +2713,7 @@ print_arg_types (struct type **args, int spaces)
while (*args != NULL)
{
recursive_dump_type (*args, spaces + 2);
if ((*args++)->code == TYPE_CODE_VOID)
if (TYPE_CODE (*args++) == TYPE_CODE_VOID)
{
break;
}

View file

@ -3230,7 +3230,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
else /* expect DNTT_TYPE_FUNC_TEMPLATE */
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc_template.retval,
objfile));
memcpy ((char *) type, (char *) type1, sizeof (struct type));
replace_type (type, type1);
/* Mark it -- in the middle of processing */
TYPE_FLAGS (type) |= TYPE_FLAG_INCOMPLETE;
@ -3407,7 +3407,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
objfile));
memcpy ((char *) type, (char *) type1, sizeof (struct type));
replace_type (type, type1);
/* Mark it -- in the middle of processing */
TYPE_FLAGS (type) |= TYPE_FLAG_INCOMPLETE;
@ -3968,23 +3968,28 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
fn_p->field.fn_fields[ix].type = memtype;
/* The argument list */
fn_p->field.fn_fields[ix].type->type_specific.arg_types =
(struct type **) obstack_alloc (&objfile->type_obstack,
sizeof (struct type *) * (memtype->nfields + 1));
for (i = 0; i < memtype->nfields; i++)
fn_p->field.fn_fields[ix].type->type_specific.arg_types[i] = memtype->fields[i].type;
TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types
= (struct type **) obstack_alloc (&objfile->type_obstack,
(sizeof (struct type *)
* (TYPE_NFIELDS (memtype)
+ 1)));
for (i = 0; i < TYPE_NFIELDS (memtype); i++)
TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
.arg_types[i] = TYPE_FIELDS (memtype)[i].type;
/* void termination */
fn_p->field.fn_fields[ix].type->type_specific.arg_types[memtype->nfields] = builtin_type_void;
TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
.arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void;
/* pai: It's not clear why this args field has to be set. Perhaps
* it should be eliminated entirely. */
fn_p->field.fn_fields[ix].args =
(struct type **) obstack_alloc (&objfile->type_obstack,
sizeof (struct type *) * (memtype->nfields + 1));
for (i = 0; i < memtype->nfields; i++)
fn_p->field.fn_fields[ix].args[i] = memtype->fields[i].type;
sizeof (struct type *) * (TYPE_NFIELDS (memtype) + 1));
for (i = 0; i < TYPE_NFIELDS (memtype); i++)
fn_p->field.fn_fields[ix].args[i]
= TYPE_FIELDS (memtype)[i].type;
/* null-terminated, unlike arg_types above e */
fn_p->field.fn_fields[ix].args[memtype->nfields] = NULL;
fn_p->field.fn_fields[ix].args[TYPE_NFIELDS (memtype)] = NULL;
}
/* For virtual functions, fill in the voffset field with the
* virtual table offset. (This is just copied over from the
@ -4428,7 +4433,7 @@ fix_static_member_physnames (struct type *type, char *class_name,
if (TYPE_FIELD_STATIC_PHYSNAME (type, i))
return; /* physnames are already set */
SET_FIELD_PHYSNAME (type->fields[i],
SET_FIELD_PHYSNAME (TYPE_FIELDS (type)[i],
obstack_alloc (&objfile->type_obstack,
strlen (class_name) + strlen (TYPE_FIELD_NAME (type, i)) + 3));
strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name);
@ -4465,23 +4470,23 @@ fixup_class_method_type (struct type *class, struct type *method,
/* Set the method type */
TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method;
/* The argument list */
(TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j))->type_specific.arg_types
TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types
= (struct type **) obstack_alloc (&objfile->type_obstack,
sizeof (struct type *) * (method->nfields + 1));
for (k = 0; k < method->nfields; k++)
(TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j))->type_specific.arg_types[k] = method->fields[k].type;
sizeof (struct type *) * (TYPE_NFIELDS (method) + 1));
for (k = 0; k < TYPE_NFIELDS (method); k++)
TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type;
/* void termination */
(TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j))->type_specific.arg_types[method->nfields] = builtin_type_void;
TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void;
/* pai: It's not clear why this args field has to be set. Perhaps
* it should be eliminated entirely. */
(TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args
= (struct type **) obstack_alloc (&objfile->type_obstack,
sizeof (struct type *) * (method->nfields + 1));
for (k = 0; k < method->nfields; k++)
(TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[k] = method->fields[k].type;
sizeof (struct type *) * (TYPE_NFIELDS (method) + 1));
for (k = 0; k < TYPE_NFIELDS (method); k++)
(TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[k] = TYPE_FIELDS (method)[k].type;
/* null-terminated, unlike arg_types above */
(TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[method->nfields] = NULL;
(TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[TYPE_NFIELDS (method)] = NULL;
/* Break out of both loops -- only one method to fix up in a class */
goto finish;
@ -4850,7 +4855,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
}
/* Build the correct name. */
structtype->name
TYPE_NAME (structtype)
= (char *) obstack_alloc (&objfile->type_obstack,
strlen (prefix) + strlen (suffix) + 1);
TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix);

View file

@ -832,7 +832,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
else
{
t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);
if (STREQ (name, "malloc") && t->code == TYPE_CODE_VOID)
if (STREQ (name, "malloc") && TYPE_CODE (t) == TYPE_CODE_VOID)
{
/* I don't know why, but, at least under Alpha GNU/Linux,
when linking against a malloc without debugging
@ -1604,7 +1604,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
dereference them. */
while (TYPE_CODE (tp) == TYPE_CODE_PTR
|| TYPE_CODE (tp) == TYPE_CODE_ARRAY)
tp = tp->target_type;
tp = TYPE_TARGET_TYPE (tp);
/* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries

View file

@ -58,7 +58,7 @@ is_pascal_string_type (struct type *type,int *length_pos,
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
if (length_size)
*length_size = TYPE_FIELD_TYPE (type, 0)->length;
*length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (char_size)
@ -76,7 +76,7 @@ is_pascal_string_type (struct type *type,int *length_pos,
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (length_size)
*length_size = TYPE_FIELD_TYPE (type, 1)->length;
*length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 1));
if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
/* FIXME: how can I detect wide chars in GPC ?? */

View file

@ -1488,7 +1488,7 @@ hand_function_call (struct value *function, int nargs, struct value **args)
if (param_type)
/* if this parameter is a pointer to function */
if (TYPE_CODE (param_type) == TYPE_CODE_PTR)
if (TYPE_CODE (param_type->target_type) == TYPE_CODE_FUNC)
if (TYPE_CODE (TYPE_TARGET_TYPE (param_type)) == TYPE_CODE_FUNC)
/* elz: FIXME here should go the test about the compiler used
to compile the target. We want to issue the error
message only if the compiler used was HP's aCC.

View file

@ -372,18 +372,18 @@ classify_argument (struct type *type,
case TYPE_CODE_STRUCT:
{
int j;
for (j = 0; j < type->nfields; ++j)
for (j = 0; j < TYPE_NFIELDS (type); ++j)
{
int num = classify_argument (type->fields[j].type,
int num = classify_argument (TYPE_FIELDS (type)[j].type,
subclasses,
(type->fields[j].loc.bitpos
(TYPE_FIELDS (type)[j].loc.bitpos
+ bit_offset) % 256);
if (!num)
return 0;
for (i = 0; i < num; i++)
{
int pos =
(type->fields[j].loc.bitpos + bit_offset) / 8 / 8;
(TYPE_FIELDS (type)[j].loc.bitpos + bit_offset) / 8 / 8;
classes[i + pos] =
merge_classes (subclasses[i], classes[i + pos]);
}
@ -394,7 +394,7 @@ classify_argument (struct type *type,
{
int num;
num = classify_argument (type->target_type,
num = classify_argument (TYPE_TARGET_TYPE (type),
subclasses, bit_offset);
if (!num)
return 0;
@ -413,10 +413,10 @@ classify_argument (struct type *type,
{
int j;
{
for (j = 0; j < type->nfields; ++j)
for (j = 0; j < TYPE_NFIELDS (type); ++j)
{
int num;
num = classify_argument (type->fields[j].type,
num = classify_argument (TYPE_FIELDS (type)[j].type,
subclasses, bit_offset);
if (!num)
return 0;