* parse.c (follow_types): Given (TYPE[]) (i.e. with no length),
authorPer Bothner <per@bothner.com>
Fri, 17 Feb 1995 23:20:29 +0000 (23:20 +0000)
committerPer Bothner <per@bothner.com>
Fri, 17 Feb 1995 23:20:29 +0000 (23:20 +0000)
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.

gdb/ChangeLog
gdb/c-typeprint.c
gdb/parse.c

index 9928db66395d08e4654ca49eee1fa57415fa2bf9..1bc7ccb0ebacae9733b61d95077fb29bd8569630 100644 (file)
@@ -1,3 +1,12 @@
+Thu Feb 16 15:06:12 1995  Per Bothner  <bothner@kalessin.cygnus.com>
+
+       * 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.
+
 Thu Feb 16 16:06:50 1995  Michael Meissner  <meissner@tiktok.cygnus.com>
 
        * dcache.c (insque, remque): Rewrite Linux support.
index 396873751d53aab6cfbde047111c73f2a19ec293..aa5b014689950d1a79e361cb0a2141c446f52213 100644 (file)
@@ -386,7 +386,8 @@ c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
        fprintf_filtered (stream, ")");
       
       fprintf_filtered (stream, "[");
-      if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
+      if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+         && TYPE_ARRAY_UPPER_BOUND_TYPE(type) != BOUND_CANNOT_BE_DETERMINED)
        fprintf_filtered (stream, "%d",
                          (TYPE_LENGTH (type)
                           / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
index dff887e0d95547e9b5128df3112a6fb35dfa4900..daa0ae60d76843345f56455ac98156eada6aaf39 100644 (file)
@@ -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);