Remove TYPE_NOSIGN "char" hack
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Tue, 6 Sep 2016 15:30:13 +0000 (17:30 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Tue, 6 Sep 2016 15:30:13 +0000 (17:30 +0200)
init_type (and arch_integer_type) currently use a special hack to set the
TYPE_NOSIGN flag if the type name is exactly "char".  This commit moves the
hack up to the callers of those routines.

The special case currently can hit only for types created from dwarf2read,
but read_base_type actually implements the "char" check itself, so it is
redundant to do it in init_type as well.  (Note that stabsread.c and the
other type readers always pass NULL as name to init_type, so the special
case can never hit for those.)

A few other cases create pre-definded types with a hard-coded name of "char";
the commit simply moves setting the TYPE_NOSIGN flag to those places.

No functional change intended.

gdb/ChangeLog:

* gdbtypes.c (init_type): Remove "char" special case.
(arch_integer_type): Likewise.
(gdbtypes_post_init): Set TYPE_NOSIGN for "char" type.
(objfile_type): Likewise.
* mdebugread.c (basic_type): Likewise.
* stabsread.c (rs6000_builtin_type): Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
gdb/ChangeLog
gdb/gdbtypes.c
gdb/mdebugread.c
gdb/stabsread.c

index 1fe30fdbeaef989b4d23b3edd6b082334cf6552e..5db0f666b00d85b50a1c2f0b9af92c33ef1905ee 100644 (file)
@@ -1,3 +1,12 @@
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * gdbtypes.c (init_type): Remove "char" special case.
+       (arch_integer_type): Likewise.
+       (gdbtypes_post_init): Set TYPE_NOSIGN for "char" type.
+       (objfile_type): Likewise.
+       * mdebugread.c (basic_type): Likewise.
+       * stabsread.c (rs6000_builtin_type): Likewise.
+
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * gdbtypes.h (enum type_flag_value): Remove.
index ab853d7849b0ca14d054029804c4bddbef3f1cc9..b7b638ed527957f3ba0d15b8b673acd244db8d03 100644 (file)
@@ -2748,11 +2748,6 @@ init_type (struct objfile *objfile, enum type_code code, int length,
   TYPE_LENGTH (type) = length;
   TYPE_NAME (type) = name;
 
-  /* C++ fancies.  */
-
-  if (name && strcmp (name, "char") == 0)
-    TYPE_NOSIGN (type) = 1;
-
   return type;
 }
 
@@ -4780,8 +4775,6 @@ arch_integer_type (struct gdbarch *gdbarch,
   t = arch_type (gdbarch, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name);
   if (unsigned_p)
     TYPE_UNSIGNED (t) = 1;
-  if (name && strcmp (name, "char") == 0)
-    TYPE_NOSIGN (t) = 1;
 
   return t;
 }
@@ -5046,6 +5039,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
   builtin_type->builtin_char
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
                         !gdbarch_char_signed (gdbarch), "char");
+  TYPE_NOSIGN (builtin_type->builtin_char) = 1;
   builtin_type->builtin_signed_char
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
                         0, "signed char");
@@ -5193,6 +5187,7 @@ objfile_type (struct objfile *objfile)
   objfile_type->builtin_char
     = init_integer_type (objfile, TARGET_CHAR_BIT,
                         !gdbarch_char_signed (gdbarch), "char");
+  TYPE_NOSIGN (objfile_type->builtin_char) = 1;
   objfile_type->builtin_signed_char
     = init_integer_type (objfile, TARGET_CHAR_BIT,
                         0, "signed char");
index f5aa33e7b05a3177d6af34e3f3c623cb0709a536..336609ac8aba8fe4b0bac01177d5f9b29cb57395 100644 (file)
@@ -1408,6 +1408,7 @@ basic_type (int bt, struct objfile *objfile)
 
     case btChar:
       tp = init_integer_type (objfile, 8, 0, "char");
+      TYPE_NOSIGN (tp) = 1;
       break;
 
     case btUChar:
index d929fe47c59973fd09189969e7bc6f88e5791ad3..6a4734cc2f1aab340c01edd06bcef13de6285eda 100644 (file)
@@ -2102,6 +2102,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
       break;
     case 2:
       rettype = init_integer_type (objfile, 8, 0, "char");
+      TYPE_NOSIGN (rettype) = 1;
       break;
     case 3:
       rettype = init_integer_type (objfile, 16, 0, "short");
This page took 0.033527 seconds and 4 git commands to generate.