summaryrefslogtreecommitdiff
path: root/gdb/ch-typeprint.c
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/ch-typeprint.c
parentf2ed3a80bbee4ea7e133c4b7ae56fcae3cf8699c (diff)
* 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/ch-typeprint.c')
-rw-r--r--gdb/ch-typeprint.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c
index ca0a1f6271..c85ac90f13 100644
--- a/gdb/ch-typeprint.c
+++ b/gdb/ch-typeprint.c
@@ -99,10 +99,14 @@ chill_type_print_base (type, stream, show, level)
return;
}
- check_stub_type (type);
+ if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF)
+ CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
{
+ case TYPE_CODE_TYPEDEF:
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
+ break;
case TYPE_CODE_PTR:
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
{
@@ -111,7 +115,7 @@ chill_type_print_base (type, stream, show, level)
break;
}
fprintf_filtered (stream, "REF ");
- chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
break;
case TYPE_CODE_BOOL:
@@ -124,16 +128,21 @@ chill_type_print_base (type, stream, show, level)
break;
case TYPE_CODE_ARRAY:
- range_type = TYPE_FIELD_TYPE (type, 0);
- index_type = TYPE_TARGET_TYPE (range_type);
- low_bound = TYPE_FIELD_BITPOS (range_type, 0);
- high_bound = TYPE_FIELD_BITPOS (range_type, 1);
fputs_filtered ("ARRAY (", stream);
- print_type_scalar (index_type, low_bound, stream);
- fputs_filtered (":", stream);
- print_type_scalar (index_type, high_bound, stream);
+ range_type = TYPE_FIELD_TYPE (type, 0);
+ if (TYPE_CODE (range_type) != TYPE_CODE_RANGE)
+ chill_print_type (range_type, "", stream, 0, level);
+ else
+ {
+ index_type = TYPE_TARGET_TYPE (range_type);
+ low_bound = TYPE_FIELD_BITPOS (range_type, 0);
+ high_bound = TYPE_FIELD_BITPOS (range_type, 1);
+ print_type_scalar (index_type, low_bound, stream);
+ fputs_filtered (":", stream);
+ print_type_scalar (index_type, high_bound, stream);
+ }
fputs_filtered (") ", stream);
- chill_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ chill_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, level);
break;
case TYPE_CODE_BITSTRING:
@@ -158,7 +167,7 @@ chill_type_print_base (type, stream, show, level)
case TYPE_CODE_MEMBER:
fprintf_filtered (stream, "MEMBER ");
- chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
break;
case TYPE_CODE_REF:
fprintf_filtered (stream, "/*LOC*/ ");
@@ -178,7 +187,7 @@ chill_type_print_base (type, stream, show, level)
if (TYPE_CODE (param_type) == TYPE_CODE_REF)
{
chill_type_print_base (TYPE_TARGET_TYPE (param_type),
- stream, show, level);
+ stream, 0, level);
fputs_filtered (" LOC", stream);
}
else
@@ -188,7 +197,7 @@ chill_type_print_base (type, stream, show, level)
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
{
fputs_filtered (" RETURNS (", stream);
- chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
fputs_filtered (")", stream);
}
break;
@@ -197,7 +206,7 @@ chill_type_print_base (type, stream, show, level)
if (chill_varying_type (type))
{
chill_type_print_base (TYPE_FIELD_TYPE (type, 1),
- stream, show, level);
+ stream, 0, level);
fputs_filtered (" VARYING", stream);
}
else
@@ -269,9 +278,6 @@ chill_type_print_base (type, stream, show, level)
break;
case TYPE_CODE_RANGE:
- if (TYPE_DUMMY_RANGE (type) > 0)
- chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
- else
{
struct type *target = TYPE_TARGET_TYPE (type);
if (target && TYPE_NAME (target))