aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-17 23:20:29 +0000
committerPer Bothner <per@bothner.com>1995-02-17 23:20:29 +0000
commitfda36387ebfea914119a1287e6e492a1aa7af3ef (patch)
tree5b44a101e8b30b3ef4f643dcc3917ed536b1d5d6 /gdb/parse.c
parent07f27bb80c97939639598ef622548e830adb2ae7 (diff)
downloadfsf-binutils-gdb-fda36387ebfea914119a1287e6e492a1aa7af3ef.zip
fsf-binutils-gdb-fda36387ebfea914119a1287e6e492a1aa7af3ef.tar.gz
fsf-binutils-gdb-fda36387ebfea914119a1287e6e492a1aa7af3ef.tar.bz2
* parse.c (follow_types): Given (TYPE[]) (i.e. with no length),
create a 0-length array type, and set BOUND_CANNOT_BE_DETERMINED. * valops.c (value_cast): If a cast like (TYPE[])VALUE (i.e. array of unknown length) use sizeof(VALUE)/sizeof(TYPE) as the length. * c-typeprint.c (c_type_print_varspec_suffix): If array length is 0, print it, but not if upper_bound is BOUND_CANNOT_BE_DETERMINED.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index dff887e..daa0ae6 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -875,18 +875,16 @@ follow_types (follow_type)
break;
case tp_array:
array_size = pop_type_int ();
- if (array_size != -1)
- {
- range_type =
- create_range_type ((struct type *) NULL,
- builtin_type_int, 0,
- array_size - 1);
- follow_type =
- create_array_type ((struct type *) NULL,
- follow_type, range_type);
- }
- else
- follow_type = lookup_pointer_type (follow_type);
+ range_type =
+ create_range_type ((struct type *) NULL,
+ builtin_type_int, 0,
+ array_size >= 0 ? array_size - 1 : 0);
+ follow_type =
+ create_array_type ((struct type *) NULL,
+ follow_type, range_type);
+ if (array_size < 0)
+ TYPE_ARRAY_UPPER_BOUND_TYPE(follow_type)
+ = BOUND_CANNOT_BE_DETERMINED;
break;
case tp_function:
follow_type = lookup_function_type (follow_type);