#include "common/enum-flags.h"
#include "common/underlying.h"
#include "common/print-utils.h"
+#include "gdbarch.h"
/* Forward declarations for prototypes. */
struct field;
/* * Some bits for the type's instance_flags word. See the macros
below for documentation on each bit. */
-enum type_instance_flag_value
+enum type_instance_flag_value : unsigned
{
TYPE_INSTANCE_FLAG_CONST = (1 << 0),
TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1),
/* * Name of this type, or NULL if none.
- This is used for printing only, except by poorly designed C++
- code. For looking up a name, look for a symbol in the
- VAR_DOMAIN. This is generally allocated in the objfile's
- obstack. However coffread.c uses malloc. */
+ This is used for printing only. For looking up a name, look for
+ a symbol in the VAR_DOMAIN. This is generally allocated in the
+ objfile's obstack. However coffread.c uses malloc. */
const char *name;
- /* * Tag name for this type, or NULL if none. This means that the
- name of the type consists of a keyword followed by the tag name.
- Which keyword is determined by the type code ("struct" for
- TYPE_CODE_STRUCT, etc.). As far as I know C/C++ are the only
- languages with this feature.
-
- This is used for printing only, except by poorly designed C++ code.
- For looking up a name, look for a symbol in the STRUCT_DOMAIN.
- One more legitimate use is that if TYPE_STUB is set, this is
- the name to use to look for definitions in other files. */
-
- const char *tag_name;
-
/* * Every type is now associated with a particular objfile, and the
type is allocated on the objfile_obstack for that objfile. One
problem however, is that there are times when gdb allocates new
#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
#define TYPE_NAME(thistype) TYPE_MAIN_TYPE(thistype)->name
-#define TYPE_TAG_NAME(type) TYPE_MAIN_TYPE(type)->tag_name
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
struct type *builtin_uint8;
struct type *builtin_int16;
struct type *builtin_uint16;
+ struct type *builtin_int24;
+ struct type *builtin_uint24;
struct type *builtin_int32;
struct type *builtin_uint32;
struct type *builtin_int64;
extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
-/* * Allocate space for storing data associated with a particular
+/* 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
objfile_obstack, then the space for data associated with that type
- will also be allocated on the objfile_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_OWNED (t) \
- ? obstack_alloc (&TYPE_OBJFILE (t) -> objfile_obstack, size) \
- : xmalloc (size))
-
-#define TYPE_ZALLOC(t,size) \
- (TYPE_OBJFILE_OWNED (t) \
- ? memset (obstack_alloc (&TYPE_OBJFILE (t)->objfile_obstack, size), \
- 0, size) \
- : xzalloc (size))
+ will also be allocated on the objfile_obstack. If the type is
+ associated with a gdbarch, then the space for data associated with that
+ type will also be allocated on the gdbarch_obstack.
+
+ If a type is not associated with neither an objfile or a gdbarch then
+ you should not use this macro to allocate space for data, instead you
+ should call xmalloc directly, and ensure the memory is correctly freed
+ when it is no longer needed. */
+
+#define TYPE_ALLOC(t,size) \
+ (obstack_alloc ((TYPE_OBJFILE_OWNED (t) \
+ ? &TYPE_OBJFILE (t)->objfile_obstack \
+ : gdbarch_obstack (TYPE_OWNER (t).gdbarch)), \
+ size))
+
+
+/* See comment on TYPE_ALLOC. */
+
+#define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
/* Use alloc_type to allocate a type owned by an objfile. Use
alloc_type_arch to allocate a type owned by an architecture. Use
extern struct type *allocate_stub_method (struct type *);
-extern const char *type_name_no_tag (const struct type *);
-
-extern const char *type_name_no_tag_or_error (struct type *type);
+extern const char *type_name_or_error (struct type *type);
extern struct type *lookup_struct_elt_type (struct type *, const char *, int);