* stabsread.c (rs6000_builtin_type): Make bool type unsigned.
authorPer Bothner <per@bothner.com>
Wed, 24 Jan 1996 07:02:57 +0000 (07:02 +0000)
committerPer Bothner <per@bothner.com>
Wed, 24 Jan 1996 07:02:57 +0000 (07:02 +0000)
(read_one_struct_field):  Support boolean bitfields.
* c-valprint.c (c_val_print): Print booleans properly.

gdb/ChangeLog
gdb/c-valprint.c
gdb/stabsread.c

index e8ccefe3f6f2384a23c11947c9d7489298d27375..69faad22039b76c4e89e3a4bdc6fa05c73ae65b2 100644 (file)
@@ -1,3 +1,9 @@
+Tue Jan 23 18:02:35 1996  Per Bothner  <bothner@kalessin.cygnus.com>
+
+       * stabsread.c (rs6000_builtin_type):  Make bool type unsigned.
+       (read_one_struct_field):  Support boolean bitfields.
+       * c-valprint.c (c_val_print): Print booleans properly.
+
 Tue Jan 23 18:54:09 1996  Stan Shebs  <shebs@andros.cygnus.com>
 
        * remote-vxsparc.c (vx_convert_to_virtual, vx_convert_from_virtual):
index f4abf7fe848b8d1f6b39a21d0b6bbc9bd3e98da1..a16f87cf6eb3aec683171dd1201cdef373f34914 100644 (file)
@@ -335,8 +335,20 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
       break;
 
     case TYPE_CODE_BOOL:
-      /* Do something at least vaguely reasonable, for example if the
-        language is set wrong.  */
+      format = format ? format : output_format;
+      if (format)
+       print_scalar_formatted (valaddr, type, format, 0, stream);
+      else
+       {
+         val = unpack_long (type, valaddr);
+         if (val == 0)
+           fputs_filtered ("false", stream);
+         else if (val == 1)
+           fputs_filtered ("true", stream);
+         else
+           print_longest (stream, 'd', 0, val);
+       }
+      break;
 
     case TYPE_CODE_RANGE:
       /* FIXME: create_range_type does not set the unsigned bit in a
index ba36fb26196e0631718e624190a54192236c04d5..988c75cb178999639394259b38cc04b9e944f4db 100644 (file)
@@ -1855,7 +1855,8 @@ rs6000_builtin_type (typenum)
       rettype = init_type (TYPE_CODE_INT, 4, 0, "integer", NULL);
       break;
     case 16:
-      rettype = init_type (TYPE_CODE_BOOL, 4, 0, "boolean", NULL);
+      rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
+                          "boolean", NULL);
       break;
     case 17:
       rettype = init_type (TYPE_CODE_FLT, 4, 0, "short real", NULL);
@@ -2458,6 +2459,7 @@ read_one_struct_field (fip, pp, p, type, objfile)
         and treat enums as if they had the width of ints.  */
 
       if (TYPE_CODE (fip -> list -> field.type) != TYPE_CODE_INT
+         && TYPE_CODE (fip -> list -> field.type) != TYPE_CODE_BOOL
          && TYPE_CODE (fip -> list -> field.type) != TYPE_CODE_ENUM)
        {
          fip -> list -> field.bitsize = 0;
This page took 0.032181 seconds and 4 git commands to generate.