summaryrefslogtreecommitdiff
path: root/gdb/f-typeprint.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-10-02 22:06:08 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-10-02 22:06:08 +0000
commitd78df370424237bb0a421cf95204510a867120ce (patch)
treea983521f159c0c8a1026d23010241657ad015575 /gdb/f-typeprint.c
parent92f03fcbe1cfff6dcca4a3a5185b56f3a9fa358e (diff)
gdb/
Replace TYPE_ARRAY_{UPPER,LOWER}_BOUND_TYPE by a bit if {un,}defined. * c-typeprint.c (c_type_print_varspec_suffix), m2-typeprint.c (m2_array), p-typeprint.c (pascal_type_print_varspec_prefix), valops.c (value_cast), varobj.c (c_number_of_children): Replace TYPE_ARRAY_UPPER_BOUND_TYPE compared to BOUND_CANNOT_BE_DETERMINED by TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. * parse.c (follow_types): Use TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. * f-valprint.c (f77_get_dynamic_upperbound): Replace with ... (f77_get_upperbound): ... this function handling now only TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. (f77_get_dynamic_lowerbound): Replace with ... (f77_get_lowerbound): ... this function handling now only TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED. (f77_get_dynamic_length_of_aggregate, f77_create_arrayprint_offset_tbl): Update their callers. * eval.c (evaluate_subexp_standard): Update their callers. * f-lang.h (f77_get_dynamic_upperbound, f77_get_upperbound) (f77_get_dynamic_lowerbound, f77_get_lowerbound): Update their prototypes. (BOUND_FETCH_OK, BOUND_FETCH_ERROR): Remove. * f-typeprint.c (f_type_print_varspec_suffix, f_type_print_base): Remove the lower_bound_was_default variable. Update the f77_get_dynamic_upperbound, f77_get_upperbound and TYPE_ARRAY_UPPER_BOUND_TYPE calls. * gdbtypes.c (print_bound_type): Remove the function. (recursive_dump_type): Remove its calls printing UPPER_BOUND_TYPE and LOWER_BOUND_TYPE. * gdbtypes.h (enum array_bound_type): Remove. (struct main_type): Remove the fields upper_bound_type and lower_bound_type. Comment the new overload of the field artificial. (TYPE_ARRAY_UPPER_BOUND_TYPE): Replace by ... (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED): ... this macro. (TYPE_ARRAY_LOWER_BOUND_TYPE): Replace by ... (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): ... this macro. gdb/testsuite/ * gdb.base/maint.exp (maint print type): Remove printing UPPER_BOUND_TYPE and LOWER_BOUND_TYPE.
Diffstat (limited to 'gdb/f-typeprint.c')
-rw-r--r--gdb/f-typeprint.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index ad93152273..081d24af1f 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -153,7 +153,6 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr, int demangled_args)
{
int upper_bound, lower_bound;
- int lower_bound_was_default = 0;
static int arrayprint_recurse_level = 0;
int retcode;
@@ -176,35 +175,19 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
- retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
-
- lower_bound_was_default = 0;
-
- if (retcode == BOUND_FETCH_ERROR)
- fprintf_filtered (stream, "???");
- else if (lower_bound == 1) /* The default */
- lower_bound_was_default = 1;
- else
- fprintf_filtered (stream, "%d", lower_bound);
-
- if (lower_bound_was_default)
- lower_bound_was_default = 0;
- else
- fprintf_filtered (stream, ":");
+ lower_bound = f77_get_lowerbound (type);
+ if (lower_bound != 1) /* Not the default. */
+ fprintf_filtered (stream, "%d:", lower_bound);
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*' */
- if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
fprintf_filtered (stream, "*");
else
{
- retcode = f77_get_dynamic_upperbound (type, &upper_bound);
-
- if (retcode == BOUND_FETCH_ERROR)
- fprintf_filtered (stream, "???");
- else
- fprintf_filtered (stream, "%d", upper_bound);
+ upper_bound = f77_get_upperbound (type);
+ fprintf_filtered (stream, "%d", upper_bound);
}
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
@@ -354,16 +337,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_STRING:
/* Strings may have dynamic upperbounds (lengths) like arrays. */
- if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
fprintfi_filtered (level, stream, "character*(*)");
else
{
- retcode = f77_get_dynamic_upperbound (type, &upper_bound);
-
- if (retcode == BOUND_FETCH_ERROR)
- fprintf_filtered (stream, "character*???");
- else
- fprintf_filtered (stream, "character*%d", upper_bound);
+ upper_bound = f77_get_upperbound (type);
+ fprintf_filtered (stream, "character*%d", upper_bound);
}
break;