* coffread.c (decode_type): Call alloc_type to alloc new

types.
	* stabsread.c (read_array_type, read_range_type, define_symbol):
	Call alloc_type to alloc new types.
	* stabsread.c (define_symbol):  Move dbl_valu symbol field data
	from type_obstack to symbol_obstack.
	* stabsread.c (define_symbol):  Move typedef_sym from type_obstack
	to symbol_obstack.
	* gdbtypes.h (TYPE_ALLOC):  New macro to allocate space for data
	associated with a type, using the same mechanism as was used to
	allocate space for the type structure itself.
	* coffread.c (patch_type, coff_read_struct_type,
	coff_read_enum_type):  Use TYPE_ALLOC.
	* dwarfread.c (struct_type):  Use TYPE_ALLOC.
	* gdbtypes.c (create_array_type, check_stub_method,
	allocate_cplus_struct_type):  Use TYPE_ALLOC.
	* mipsread.c (parse_symbol, parse_type):  Use TYPE_ALLOC.
	* stabsread.c (read_struct_type, read_array_type, read_enum_type,
	read_range_type):  Use TYPE_ALLOC.
This commit is contained in:
Fred Fish
1992-08-24 00:13:11 +00:00
parent ca8820f938
commit dac9734e58
5 changed files with 63 additions and 43 deletions

View File

@@ -507,6 +507,20 @@ extern struct type *builtin_type_m2_bool;
TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
: MIN_OF_SIZE(TYPE_LENGTH(t))
/* Allocate space for storing data associated with a particular type.
We ensure that the space is allocated using the same mechanism that
was used to allocate the space for the type structure itself. I.E.
if the type is on an objfile's type_obstack, then the space for data
associated with that type will also be allocated on the type_obstack.
If the type is not associated with any particular objfile (such as
builtin types), then the data space will be allocated with xmalloc,
the same as for the type structure. */
#define TYPE_ALLOC(t,size) \
TYPE_OBJFILE (t) != NULL \
? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \
: xmalloc (size)
extern struct type *
alloc_type PARAMS ((struct objfile *));