summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-11-30 01:07:28 +0000
committerPer Bothner <per@bothner.com>1995-11-30 01:07:28 +0000
commitd1f4065e6499c42088b36a058b1de4035d051392 (patch)
tree0f19f4040ccfde68414a60659dabece8a6c1d79e /gdb/gdbtypes.h
parentf2ed3a80bbee4ea7e133c4b7ae56fcae3cf8699c (diff)
downloadbinutils-gdb-d1f4065e6499c42088b36a058b1de4035d051392.tar.gz
* gdbtypes.h (enum type_code): Added TYPE_CODE_TYPEDEF.
(check_typedef): New prototype. (CHECK_TYPEDEF): New macro. (TYPE_DUMMY_RANGE): Removed. * gdbtypes.c (get_discrete_bounds): Fix paren error; make more robust. (create_array_type): Don't force_to_range_type; users of the array are responsible for handling non-range index types. (create_set_type): Likewise. (force_to_range_type): Removed. (check_typedef): New function handles stub types and typedefs. (check_stub_type): Just call check_typedef. (To be removed.) (recursive_dump_type): Handle TYPE_CODE_TYPEDEF. * ch-lang.c (type_lower_upper): Use get_discrete_bounds. (evaluate_subexp_chill): Handle string repetition. Re-arrange to handle EVAL_AVOID_SIDE_EFFECTS better. * ch-typeprint.c (chill_type_print_base): Handle TYPE_CODE_TYPEDEF. Pass show=0 in recursive calls various places. (case TYPE_CODE_ARRAY): Don't require index type to have TYPE_CODE_RANGE. (case TYPE_CODE_RANGE): Don't need to support TYPE_DUMMY_RANGE. * gdbtypes.c, ch-lang.c, ch-typeprint.c (numerous places): Add check_typedef/CHECK_TYPEDEF as needed.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 29d86014d7e..59313d799fd 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -120,7 +120,9 @@ enum type_code
TYPE_CODE_BOOL,
/* Fortran */
- TYPE_CODE_COMPLEX /* Complex float */
+ TYPE_CODE_COMPLEX, /* Complex float */
+
+ TYPE_CODE_TYPEDEF
};
/* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an
@@ -145,9 +147,10 @@ enum type_code
#define TYPE_FLAG_STUB (1 << 2)
/* The target type of this type is a stub type, and this type needs to
- be updated if it gets un-stubbed in check_stub_type. Currently only
- used for arrays and ranges, in which TYPE_LENGTH of the array/range
- gets set based on the TYPE_LENGTH of the target type. */
+ be updated if it gets un-stubbed in check_typedef.
+ Used for arrays and ranges, in which TYPE_LENGTH of the array/range
+ gets set based on the TYPE_LENGTH of the target type.
+ Also, set for TYPE_CODE_TYPEDEF. */
#define TYPE_FLAG_TARGET_STUB (1 << 3)
@@ -486,10 +489,16 @@ allocate_cplus_struct_type PARAMS ((struct type *));
#define TYPE_TARGET_TYPE(thistype) (thistype)->target_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
+/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
+ But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
+ so you only have to call check_typedef once. Since allocate_value
+ calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
#define TYPE_LENGTH(thistype) (thistype)->length
#define TYPE_OBJFILE(thistype) (thistype)->objfile
#define TYPE_FLAGS(thistype) (thistype)->flags
#define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED)
+/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you wan the real
+ type, you need to do TYPE_CODE (check_type (this_type)). */
#define TYPE_CODE(thistype) (thistype)->code
#define TYPE_NFIELDS(thistype) (thistype)->nfields
#define TYPE_FIELDS(thistype) (thistype)->fields
@@ -497,9 +506,6 @@ allocate_cplus_struct_type PARAMS ((struct type *));
#define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
#define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0)
#define TYPE_HIGH_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 1)
-/* If TYPE_DUMMY_RANGE is true for a range type, it was allocated
- by force_to_range_type. */
-#define TYPE_DUMMY_RANGE(type) ((type)->vptr_fieldno)
/* Moto-specific stuff for FORTRAN arrays */
@@ -734,8 +740,10 @@ lookup_unsigned_typename PARAMS ((char *));
extern struct type *
lookup_signed_typename PARAMS ((char *));
-extern void
-check_stub_type PARAMS ((struct type *));
+extern struct type *
+check_typedef PARAMS ((struct type *));
+
+#define CHECK_TYPEDEF(TYPE) (TYPE) = check_typedef (TYPE)
extern void
check_stub_method PARAMS ((struct type *, int, int));