1 /* Support routines for manipulating internal types for GDB.
2 Copyright (C) 1992 Free Software Foundation, Inc.
3 Contributed by Cygnus Support, using pieces from other GDB modules.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #include "expression.h"
32 /* Alloc a new type structure and fill it with some defaults. If
33 OBJFILE is non-NULL, then allocate the space for the type structure
34 in that objfile's type_obstack. */
38 struct objfile
*objfile
;
40 register struct type
*type
;
42 /* Alloc the structure and start off with all fields zeroed. */
46 type
= (struct type
*) xmalloc (sizeof (struct type
));
50 type
= (struct type
*) obstack_alloc (&objfile
-> type_obstack
,
51 sizeof (struct type
));
53 (void) memset ((char *)type
, 0, sizeof (struct type
));
55 /* Initialize the fields that might not be zero. */
57 TYPE_CODE (type
) = TYPE_CODE_UNDEF
;
58 TYPE_OBJFILE (type
) = objfile
;
59 TYPE_VPTR_FIELDNO (type
) = -1;
64 /* Given a type TYPE, return a type of pointers to that type.
65 May need to construct such a type if this is the first use. */
68 lookup_pointer_type (type
)
71 register struct type
*ptype
;
73 if ((ptype
= TYPE_POINTER_TYPE (type
)) == NULL
)
75 /* This is the first time anyone wanted a pointer to a TYPE. */
77 ptype
= alloc_type (TYPE_OBJFILE (type
));
78 TYPE_TARGET_TYPE (ptype
) = type
;
79 TYPE_POINTER_TYPE (type
) = ptype
;
81 /* We assume the machine has only one representation for pointers! */
83 TYPE_LENGTH (ptype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
84 TYPE_CODE (ptype
) = TYPE_CODE_PTR
;
86 /* pointers are unsigned */
87 TYPE_FLAGS(ptype
) |= TYPE_FLAG_UNSIGNED
;
94 lookup_reference_type (type
)
97 register struct type
*rtype
;
99 if ((rtype
= TYPE_REFERENCE_TYPE (type
)) == NULL
)
101 /* This is the first time anyone wanted a pointer to a TYPE. */
103 rtype
= alloc_type (TYPE_OBJFILE (type
));
104 TYPE_TARGET_TYPE (rtype
) = type
;
105 TYPE_REFERENCE_TYPE (type
) = rtype
;
107 /* We assume the machine has only one representation for pointers! */
108 /* FIXME: This confuses host<->target data representations, and is a
109 poor assumption besides. */
111 TYPE_LENGTH (rtype
) = sizeof (char *);
112 TYPE_CODE (rtype
) = TYPE_CODE_REF
;
118 /* Given a type TYPE, return a type of functions that return that type.
119 May need to construct such a type if this is the first use. */
122 lookup_function_type (type
)
125 register struct type
*ptype
;
127 if ((ptype
= TYPE_FUNCTION_TYPE (type
)) == NULL
)
129 /* This is the first time anyone wanted a function returning a TYPE. */
131 ptype
= alloc_type (TYPE_OBJFILE (type
));
132 TYPE_TARGET_TYPE (ptype
) = type
;
133 TYPE_FUNCTION_TYPE (type
) = ptype
;
135 TYPE_LENGTH (ptype
) = 1;
136 TYPE_CODE (ptype
) = TYPE_CODE_FUNC
;
141 /* Implement direct support for MEMBER_TYPE in GNU C++.
142 May need to construct such a type if this is the first use.
143 The TYPE is the type of the member. The DOMAIN is the type
144 of the aggregate that the member belongs to. */
147 lookup_member_type (type
, domain
)
151 register struct type
*mtype
;
153 mtype
= alloc_type (TYPE_OBJFILE (type
));
154 smash_to_member_type (mtype
, domain
, type
);
158 /* Allocate a stub method whose return type is TYPE.
159 This apparently happens for speed of symbol reading, since parsing
160 out the arguments to the method is cpu-intensive, the way we are doing
161 it. So, we will fill in arguments later.
162 This always returns a fresh type. */
165 allocate_stub_method (type
)
170 mtype
= alloc_type (TYPE_OBJFILE (type
));
171 TYPE_TARGET_TYPE (mtype
) = type
;
172 /* _DOMAIN_TYPE (mtype) = unknown yet */
173 /* _ARG_TYPES (mtype) = unknown yet */
174 TYPE_FLAGS (mtype
) = TYPE_FLAG_STUB
;
175 TYPE_CODE (mtype
) = TYPE_CODE_METHOD
;
176 TYPE_LENGTH (mtype
) = 1;
180 /* Create an array type. Elements will be of type TYPE, and there will
183 Eventually this should be extended to take two more arguments which
184 specify the bounds of the array and the type of the index.
185 It should also be changed to be a "lookup" function, with the
186 appropriate data structures added to the type field.
187 Then read array type should call here. */
190 create_array_type (element_type
, number
)
191 struct type
*element_type
;
194 struct type
*result_type
;
195 struct type
*range_type
;
197 result_type
= alloc_type (TYPE_OBJFILE (element_type
));
199 TYPE_CODE (result_type
) = TYPE_CODE_ARRAY
;
200 TYPE_TARGET_TYPE (result_type
) = element_type
;
201 TYPE_LENGTH (result_type
) = number
* TYPE_LENGTH (element_type
);
202 TYPE_NFIELDS (result_type
) = 1;
203 TYPE_FIELDS (result_type
) = (struct field
*)
204 obstack_alloc (&TYPE_OBJFILE (result_type
) -> type_obstack
,
205 sizeof (struct field
));
208 /* Create range type. */
209 range_type
= alloc_type (TYPE_OBJFILE (result_type
));
210 TYPE_CODE (range_type
) = TYPE_CODE_RANGE
;
211 TYPE_TARGET_TYPE (range_type
) = builtin_type_int
; /* FIXME */
213 /* This should never be needed. */
214 TYPE_LENGTH (range_type
) = sizeof (int);
216 TYPE_NFIELDS (range_type
) = 2;
217 TYPE_FIELDS (range_type
) = (struct field
*)
218 obstack_alloc (&TYPE_OBJFILE (range_type
) -> type_obstack
,
219 2 * sizeof (struct field
));
220 TYPE_FIELD_BITPOS (range_type
, 0) = 0; /* FIXME */
221 TYPE_FIELD_BITPOS (range_type
, 1) = number
-1; /* FIXME */
222 TYPE_FIELD_TYPE (range_type
, 0) = builtin_type_int
; /* FIXME */
223 TYPE_FIELD_TYPE (range_type
, 1) = builtin_type_int
; /* FIXME */
225 TYPE_FIELD_TYPE(result_type
,0)=range_type
;
226 TYPE_VPTR_FIELDNO (result_type
) = -1;
228 return (result_type
);
232 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
233 A MEMBER is a wierd thing -- it amounts to a typed offset into
234 a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
235 include the offset (that's the value of the MEMBER itself), but does
236 include the structure type into which it points (for some reason).
238 FIXME: When "smashing" the type, we preserve the objfile that the
239 old type pointed to, since we aren't changing where the type is actually
240 allocated. If the two types aren't associated with the same objfile,
241 then we are in deep-s**t anyway... */
244 smash_to_member_type (type
, domain
, to_type
)
247 struct type
*to_type
;
249 struct objfile
*objfile
;
251 objfile
= TYPE_OBJFILE (type
);
253 (void) memset ((char *)type
, 0, sizeof (struct type
));
254 TYPE_OBJFILE (type
) = objfile
;
255 TYPE_TARGET_TYPE (type
) = to_type
;
256 TYPE_DOMAIN_TYPE (type
) = domain
;
257 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
258 TYPE_CODE (type
) = TYPE_CODE_MEMBER
;
261 /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
262 METHOD just means `function that gets an extra "this" argument'.
264 FIXME: When "smashing" the type, we preserve the objfile that the
265 old type pointed to, since we aren't changing where the type is actually
266 allocated. If the two types aren't associated with the same objfile,
267 then we are in deep-s**t anyway... */
270 smash_to_method_type (type
, domain
, to_type
, args
)
273 struct type
*to_type
;
276 struct objfile
*objfile
;
278 objfile
= TYPE_OBJFILE (type
);
280 (void) memset ((char *)type
, 0, sizeof (struct type
));
281 TYPE_OBJFILE (type
) = objfile
;
282 TYPE_TARGET_TYPE (type
) = to_type
;
283 TYPE_DOMAIN_TYPE (type
) = domain
;
284 TYPE_ARG_TYPES (type
) = args
;
285 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
286 TYPE_CODE (type
) = TYPE_CODE_METHOD
;
289 /* Return a typename for a struct/union/enum type
290 without the tag qualifier. If the type has a NULL name,
294 type_name_no_tag (type
)
295 register const struct type
*type
;
299 if ((name
= TYPE_NAME (type
)) != NULL
)
301 switch (TYPE_CODE (type
))
303 case TYPE_CODE_STRUCT
:
304 if(!strncmp (name
, "struct ", 7))
309 case TYPE_CODE_UNION
:
310 if(!strncmp (name
, "union ", 6))
316 if(!strncmp (name
, "enum ", 5))
326 /* Lookup a primitive type named NAME.
327 Return zero if NAME is not a primitive type.*/
330 lookup_primitive_typename (name
)
333 struct type
** const *p
;
335 for (p
= current_language
-> la_builtin_type_vector
; *p
!= NULL
; p
++)
337 if (!strcmp ((**p
) -> name
, name
))
345 /* Lookup a typedef or primitive type named NAME,
346 visible in lexical block BLOCK.
347 If NOERR is nonzero, return zero if NAME is not suitably defined. */
350 lookup_typename (name
, block
, noerr
)
355 register struct symbol
*sym
;
356 register struct type
*tmp
;
358 sym
= lookup_symbol (name
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
359 if (sym
== NULL
|| SYMBOL_CLASS (sym
) != LOC_TYPEDEF
)
361 tmp
= lookup_primitive_typename (name
);
366 else if (!tmp
&& noerr
)
372 error ("No type named %s.", name
);
375 return (SYMBOL_TYPE (sym
));
379 lookup_unsigned_typename (name
)
382 char *uns
= alloca (strlen (name
) + 10);
384 strcpy (uns
, "unsigned ");
385 strcpy (uns
+ 9, name
);
386 return (lookup_typename (uns
, (struct block
*) NULL
, 0));
389 /* Lookup a structure type named "struct NAME",
390 visible in lexical block BLOCK. */
393 lookup_struct (name
, block
)
397 register struct symbol
*sym
;
399 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
400 (struct symtab
**) NULL
);
404 error ("No struct type named %s.", name
);
406 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
408 error ("This context has class, union or enum %s, not a struct.", name
);
410 return (SYMBOL_TYPE (sym
));
413 /* Lookup a union type named "union NAME",
414 visible in lexical block BLOCK. */
417 lookup_union (name
, block
)
421 register struct symbol
*sym
;
423 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
424 (struct symtab
**) NULL
);
428 error ("No union type named %s.", name
);
430 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_UNION
)
432 error ("This context has class, struct or enum %s, not a union.", name
);
434 return (SYMBOL_TYPE (sym
));
437 /* Lookup an enum type named "enum NAME",
438 visible in lexical block BLOCK. */
441 lookup_enum (name
, block
)
445 register struct symbol
*sym
;
447 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
448 (struct symtab
**) NULL
);
451 error ("No enum type named %s.", name
);
453 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_ENUM
)
455 error ("This context has class, struct or union %s, not an enum.", name
);
457 return (SYMBOL_TYPE (sym
));
460 /* Lookup a template type named "template NAME<TYPE>",
461 visible in lexical block BLOCK. */
464 lookup_template_type (name
, type
, block
)
470 char *nam
= (char*) alloca(strlen(name
) + strlen(type
->name
) + 4);
473 strcat (nam
, type
->name
);
474 strcat (nam
, " >"); /* FIXME, extra space still introduced in gcc? */
476 sym
= lookup_symbol (nam
, block
, VAR_NAMESPACE
, 0, (struct symtab
**)NULL
);
480 error ("No template type named %s.", name
);
482 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
484 error ("This context has class, union or enum %s, not a struct.", name
);
486 return (SYMBOL_TYPE (sym
));
489 /* Given a type TYPE, lookup the type of the component of type named
491 If NOERR is nonzero, return zero if NAME is not suitably defined. */
494 lookup_struct_elt_type (type
, name
, noerr
)
501 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
&&
502 TYPE_CODE (type
) != TYPE_CODE_UNION
)
504 target_terminal_ours ();
506 fprintf (stderr
, "Type ");
507 type_print (type
, "", stderr
, -1);
508 error (" is not a structure or union type.");
511 check_stub_type (type
);
513 for (i
= TYPE_NFIELDS (type
) - 1; i
>= TYPE_N_BASECLASSES (type
); i
--)
515 char *t_field_name
= TYPE_FIELD_NAME (type
, i
);
517 if (t_field_name
&& !strcmp (t_field_name
, name
))
519 return TYPE_FIELD_TYPE (type
, i
);
523 /* OK, it's not in this class. Recursively check the baseclasses. */
524 for (i
= TYPE_N_BASECLASSES (type
) - 1; i
>= 0; i
--)
528 t
= lookup_struct_elt_type (TYPE_BASECLASS (type
, i
), name
, 0);
540 target_terminal_ours ();
542 fprintf (stderr
, "Type ");
543 type_print (type
, "", stderr
, -1);
544 fprintf (stderr
, " has no component named ");
545 fputs_filtered (name
, stderr
);
547 return (struct type
*)-1; /* For lint */
550 /* This function is really horrible, but to avoid it, there would need
551 to be more filling in of forward references. */
554 fill_in_vptr_fieldno (type
)
557 if (TYPE_VPTR_FIELDNO (type
) < 0)
560 for (i
= 1; i
< TYPE_N_BASECLASSES (type
); i
++)
562 fill_in_vptr_fieldno (TYPE_BASECLASS (type
, i
));
563 if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
)) >= 0)
565 TYPE_VPTR_FIELDNO (type
)
566 = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
));
567 TYPE_VPTR_BASETYPE (type
)
568 = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type
, i
));
575 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
577 If this is a stubbed struct (i.e. declared as struct foo *), see if
578 we can find a full definition in some other file. If so, copy this
579 definition, so we can use it in future. If not, set a flag so we
580 don't waste too much time in future. (FIXME, this doesn't seem
583 This used to be coded as a macro, but I don't think it is called
584 often enough to merit such treatment.
587 struct complaint stub_noname_complaint
=
588 {"stub type has NULL name", 0, 0};
591 check_stub_type (type
)
594 if (TYPE_FLAGS(type
) & TYPE_FLAG_STUB
)
596 char* name
= type_name_no_tag (type
);
600 complain (&stub_noname_complaint
, 0);
603 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0,
604 (struct symtab
**) NULL
);
607 memcpy ((char *)type
, (char *)SYMBOL_TYPE(sym
), sizeof (struct type
));
612 /* Ugly hack to convert method stubs into method types.
614 He ain't kiddin'. This demangles the name of the method into a string
615 including argument types, parses out each argument type, generates
616 a string casting a zero to that type, evaluates the string, and stuffs
617 the resulting type into an argtype vector!!! Then it knows the type
618 of the whole function (including argument types for overloading),
619 which info used to be in the stab's but was removed to hack back
620 the space required for them. */
623 check_stub_method (type
, i
, j
)
629 char *mangled_name
= gdb_mangle_name (type
, i
, j
);
630 char *demangled_name
= cplus_demangle (mangled_name
, 0);
631 char *argtypetext
, *p
;
632 int depth
= 0, argcount
= 1;
633 struct type
**argtypes
;
636 if (demangled_name
== NULL
)
638 error ("Internal: Cannot demangle mangled name `%s'.", mangled_name
);
641 /* Now, read in the parameters that define this type. */
642 argtypetext
= strchr (demangled_name
, '(') + 1;
654 else if (*p
== ',' && depth
== 0)
662 /* We need two more slots: one for the THIS pointer, and one for the
663 NULL [...] or void [end of arglist]. */
665 argtypes
= (struct type
**)
666 obstack_alloc (&TYPE_OBJFILE (type
) -> type_obstack
,
667 (argcount
+2) * sizeof (struct type
*));
669 argtypes
[0] = lookup_pointer_type (type
);
672 if (*p
!= ')') /* () means no args, skip while */
677 if (depth
<= 0 && (*p
== ',' || *p
== ')'))
680 parse_and_eval_type (argtypetext
, p
- argtypetext
);
698 if (p
[-2] != '.') /* ... */
700 argtypes
[argcount
] = builtin_type_void
; /* Ellist terminator */
704 argtypes
[argcount
] = NULL
; /* List terminator */
707 free (demangled_name
);
709 f
= TYPE_FN_FIELDLIST1 (type
, i
);
710 TYPE_FN_FIELD_PHYSNAME (f
, j
) = mangled_name
;
712 /* Now update the old "stub" type into a real type. */
713 mtype
= TYPE_FN_FIELD_TYPE (f
, j
);
714 TYPE_DOMAIN_TYPE (mtype
) = type
;
715 TYPE_ARG_TYPES (mtype
) = argtypes
;
716 TYPE_FLAGS (mtype
) &= ~TYPE_FLAG_STUB
;
717 TYPE_FN_FIELD_STUB (f
, j
) = 0;
720 const struct cplus_struct_type cplus_struct_default
;
723 allocate_cplus_struct_type (type
)
726 if (!HAVE_CPLUS_STRUCT (type
))
728 TYPE_CPLUS_SPECIFIC (type
) = (struct cplus_struct_type
*)
729 obstack_alloc (¤t_objfile
-> type_obstack
,
730 sizeof (struct cplus_struct_type
));
731 *(TYPE_CPLUS_SPECIFIC(type
)) = cplus_struct_default
;
735 /* Helper function to initialize the standard scalar types. */
738 init_type (code
, length
, flags
, name
, objfile
)
743 struct objfile
*objfile
;
745 register struct type
*type
;
747 type
= alloc_type (objfile
);
748 TYPE_CODE (type
) = code
;
749 TYPE_LENGTH (type
) = length
;
750 TYPE_FLAGS (type
) |= flags
;
751 TYPE_NAME (type
) = name
;
755 if (code
== TYPE_CODE_STRUCT
|| code
== TYPE_CODE_UNION
)
757 INIT_CPLUS_SPECIFIC (type
);
762 /* Look up a fundamental type for the specified objfile.
763 May need to construct such a type if this is the first use.
765 Some object file formats (ELF, COFF, etc) do not define fundamental
766 types such as "int" or "double". Others (stabs for example), do
767 define fundamental types.
769 For the formats which don't provide fundamental types, gdb can create
770 such types, using defaults reasonable for the current target machine. */
773 lookup_fundamental_type (objfile
, typeid)
774 struct objfile
*objfile
;
777 register struct type
*type
= NULL
;
778 register struct type
**typep
;
781 if (typeid < 0 || typeid >= FT_NUM_MEMBERS
)
783 error ("internal error - invalid fundamental type id %d", typeid);
787 /* If this is the first time we */
788 if (objfile
-> fundamental_types
== NULL
)
790 nbytes
= FT_NUM_MEMBERS
* sizeof (struct type
*);
791 objfile
-> fundamental_types
= (struct type
**)
792 obstack_alloc (&objfile
-> type_obstack
, nbytes
);
793 (void) memset ((char *)objfile
-> fundamental_types
, 0, nbytes
);
795 typep
= objfile
-> fundamental_types
+ typeid;
796 if ((type
= *typep
) == NULL
)
801 error ("internal error: unhandled type id %d", typeid);
804 type
= init_type (TYPE_CODE_VOID
,
805 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
810 type
= init_type (TYPE_CODE_INT
,
811 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
813 "boolean", (struct objfile
*) NULL
);
816 type
= init_type (TYPE_CODE_PASCAL_ARRAY
,
817 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
819 "string", (struct objfile
*) NULL
);
822 type
= init_type (TYPE_CODE_INT
,
823 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
825 "char", (struct objfile
*) NULL
);
828 type
= init_type (TYPE_CODE_INT
,
829 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
831 "signed char", (struct objfile
*) NULL
);
833 case FT_UNSIGNED_CHAR
:
834 type
= init_type (TYPE_CODE_INT
,
835 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
837 "unsigned char", (struct objfile
*) NULL
);
840 type
= init_type (TYPE_CODE_INT
,
841 TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
843 "short", (struct objfile
*) NULL
);
845 case FT_SIGNED_SHORT
:
846 type
= init_type (TYPE_CODE_INT
,
847 TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
849 "signed short", (struct objfile
*) NULL
);
851 case FT_UNSIGNED_SHORT
:
852 type
= init_type (TYPE_CODE_INT
,
853 TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
855 "unsigned short", (struct objfile
*) NULL
);
858 type
= init_type (TYPE_CODE_INT
,
859 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
861 "int", (struct objfile
*) NULL
);
863 case FT_SIGNED_INTEGER
:
864 type
= init_type (TYPE_CODE_INT
,
865 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
867 "signed int", (struct objfile
*) NULL
);
869 case FT_UNSIGNED_INTEGER
:
870 type
= init_type (TYPE_CODE_INT
,
871 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
873 "unsigned int", (struct objfile
*) NULL
);
876 type
= init_type (TYPE_CODE_INT
,
877 TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
879 "long", (struct objfile
*) NULL
);
882 type
= init_type (TYPE_CODE_INT
,
883 TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
885 "signed long", (struct objfile
*) NULL
);
887 case FT_UNSIGNED_LONG
:
888 type
= init_type (TYPE_CODE_INT
,
889 TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
891 "unsigned long", (struct objfile
*) NULL
);
894 type
= init_type (TYPE_CODE_INT
,
895 TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
897 "long long", (struct objfile
*) NULL
);
899 case FT_SIGNED_LONG_LONG
:
900 type
= init_type (TYPE_CODE_INT
,
901 TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
903 "signed long long", (struct objfile
*) NULL
);
905 case FT_UNSIGNED_LONG_LONG
:
906 type
= init_type (TYPE_CODE_INT
,
907 TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
909 "unsigned long long",
910 (struct objfile
*) NULL
);
913 type
= init_type (TYPE_CODE_FLT
,
914 TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
916 "float", (struct objfile
*) NULL
);
918 case FT_DBL_PREC_FLOAT
:
919 type
= init_type (TYPE_CODE_FLT
,
920 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
922 "double", (struct objfile
*) NULL
);
924 case FT_EXT_PREC_FLOAT
:
925 type
= init_type (TYPE_CODE_FLT
,
926 TARGET_LONG_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
928 "long double", (struct objfile
*) NULL
);
931 type
= init_type (TYPE_CODE_FLT
,
932 TARGET_COMPLEX_BIT
/ TARGET_CHAR_BIT
,
934 "complex", (struct objfile
*) NULL
);
936 case FT_DBL_PREC_COMPLEX
:
937 type
= init_type (TYPE_CODE_FLT
,
938 TARGET_DOUBLE_COMPLEX_BIT
/ TARGET_CHAR_BIT
,
940 "double complex", (struct objfile
*) NULL
);
942 case FT_EXT_PREC_COMPLEX
:
943 type
= init_type (TYPE_CODE_FLT
,
944 TARGET_DOUBLE_COMPLEX_BIT
/ TARGET_CHAR_BIT
,
946 "long double complex",
947 (struct objfile
*) NULL
);
950 /* Install the newly created type in the objfile's fundamental_types