* stabsread.c (read_type): Handle stub types for bitstrings.
authorPer Bothner <per@bothner.com>
Fri, 16 Sep 1994 07:29:44 +0000 (07:29 +0000)
committerPer Bothner <per@bothner.com>
Fri, 16 Sep 1994 07:29:44 +0000 (07:29 +0000)
* stabsread.c (read_array_type):  Check for stub domain type
using TYPE_FLAG_STUB, not its length.
* gdbtypes.c (create_set_type):  Handle a stub domain type.

gdb/ChangeLog
gdb/gdbtypes.c
gdb/stabsread.c

index 764704a..27a8e6c 100644 (file)
@@ -1,5 +1,10 @@
 Fri Sep 16 00:14:40 1994  Per Bothner  (bothner@kalessin.cygnus.com)
 
+       * stabsread.c (read_type):  Handle stub types for bitstrings.
+       * stabsread.c (read_array_type):  Check for stub domain type
+       using TYPE_FLAG_STUB, not its length.
+       * gdbtypes.c (create_set_type):  Handle a stub domain type.
+
        * ch-exp.y:  Get rid of some extra non-terminals, and move
        their rules into primitive_value.
        * ch-lang.c (chill_op_print_tab):  Add '->'.
index a87d9a1..c386a42 100644 (file)
@@ -466,24 +466,23 @@ create_set_type (result_type, domain_type)
     {
       result_type = alloc_type (TYPE_OBJFILE (domain_type));
     }
-  domain_type = force_to_range_type (domain_type);
   TYPE_CODE (result_type) = TYPE_CODE_SET;
   TYPE_NFIELDS (result_type) = 1;
   TYPE_FIELDS (result_type) = (struct field *)
     TYPE_ALLOC (result_type, 1 * sizeof (struct field));
   memset (TYPE_FIELDS (result_type), 0, sizeof (struct field));
+
+  if (! (TYPE_FLAGS (domain_type) & TYPE_FLAG_STUB))
+    {
+      domain_type = force_to_range_type (domain_type);
+      low_bound = TYPE_LOW_BOUND (domain_type);
+      high_bound = TYPE_HIGH_BOUND (domain_type);
+      bit_length = high_bound - low_bound + 1;
+      TYPE_LENGTH (result_type)
+       = ((bit_length + TARGET_INT_BIT - 1) / TARGET_INT_BIT)
+         * TARGET_CHAR_BIT;
+    }
   TYPE_FIELD_TYPE (result_type, 0) = domain_type;
-  low_bound = TYPE_LOW_BOUND (domain_type);
-  high_bound = TYPE_HIGH_BOUND (domain_type);
-  bit_length = high_bound - low_bound + 1;
-  if (bit_length <= TARGET_CHAR_BIT)
-    TYPE_LENGTH (result_type) = 1;
-  else if (bit_length <= TARGET_SHORT_BIT)
-    TYPE_LENGTH (result_type) = TARGET_SHORT_BIT / TARGET_CHAR_BIT;
-  else
-    TYPE_LENGTH (result_type)
-      = ((bit_length + TARGET_INT_BIT - 1) / TARGET_INT_BIT)
-       * TARGET_CHAR_BIT;
   return (result_type);
 }
 
index fa5c31f..49d36ac 100644 (file)
@@ -1719,6 +1719,11 @@ read_type (pp, objfile)
     case 'S':
       type1 = read_type (pp, objfile);
       type = create_set_type ((struct type*) NULL, type1);
+      if (TYPE_FLAGS (type1) & TYPE_FLAG_STUB)
+       {
+         TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB;
+         add_undefined_type (type);
+       }
       if (is_string)
        TYPE_CODE (type) = TYPE_CODE_BITSTRING;
       if (typenums[0] != -1)
@@ -2989,12 +2994,8 @@ read_array_type (pp, type, objfile)
 
   /* If we have an array whose element type is not yet known, but whose
      bounds *are* known, record it to be adjusted at the end of the file.  */
-  /* FIXME: Why check for zero length rather than TYPE_FLAG_STUB?  I think
-     the two have the same effect except that the latter is cleaner and the
-     former would be wrong for types which really are zero-length (if we
-     have any).  */
 
-  if (TYPE_LENGTH (element_type) == 0 && !adjustable)
+  if ((TYPE_FLAGS (element_type) & TYPE_FLAG_STUB) && !adjustable)
     {
       TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB;
       add_undefined_type (type);