2c2fa1
commit c413c44801e449f1f0b9828b81770e752b8219af
2c2fa1
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
Date:   Tue Sep 6 17:30:13 2016 +0200
2c2fa1
2c2fa1
    Remove TYPE_NOSIGN "char" hack
2c2fa1
    
2c2fa1
    init_type (and arch_integer_type) currently use a special hack to set the
2c2fa1
    TYPE_NOSIGN flag if the type name is exactly "char".  This commit moves the
2c2fa1
    hack up to the callers of those routines.
2c2fa1
    
2c2fa1
    The special case currently can hit only for types created from dwarf2read,
2c2fa1
    but read_base_type actually implements the "char" check itself, so it is
2c2fa1
    redundant to do it in init_type as well.  (Note that stabsread.c and the
2c2fa1
    other type readers always pass NULL as name to init_type, so the special
2c2fa1
    case can never hit for those.)
2c2fa1
    
2c2fa1
    A few other cases create pre-definded types with a hard-coded name of "char";
2c2fa1
    the commit simply moves setting the TYPE_NOSIGN flag to those places.
2c2fa1
    
2c2fa1
    No functional change intended.
2c2fa1
    
2c2fa1
    gdb/ChangeLog:
2c2fa1
    
2c2fa1
            * gdbtypes.c (init_type): Remove "char" special case.
2c2fa1
            (arch_integer_type): Likewise.
2c2fa1
            (gdbtypes_post_init): Set TYPE_NOSIGN for "char" type.
2c2fa1
            (objfile_type): Likewise.
2c2fa1
            * mdebugread.c (basic_type): Likewise.
2c2fa1
            * stabsread.c (rs6000_builtin_type): Likewise.
2c2fa1
    
2c2fa1
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
2c2fa1
### a/gdb/ChangeLog
2c2fa1
### b/gdb/ChangeLog
2c2fa1
## -1,5 +1,14 @@
2c2fa1
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
 
2c2fa1
+	* gdbtypes.c (init_type): Remove "char" special case.
2c2fa1
+	(arch_integer_type): Likewise.
2c2fa1
+	(gdbtypes_post_init): Set TYPE_NOSIGN for "char" type.
2c2fa1
+	(objfile_type): Likewise.
2c2fa1
+	* mdebugread.c (basic_type): Likewise.
2c2fa1
+	* stabsread.c (rs6000_builtin_type): Likewise.
2c2fa1
+
2c2fa1
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
+
2c2fa1
 	* gdbtypes.h (enum type_flag_value): Remove.
2c2fa1
 	Remove references to TYPE_FLAG_... in comments throughout.
2c2fa1
 	* gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_... 
2c2fa1
Index: gdb-7.6.1/gdb/gdbtypes.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/gdbtypes.c	2017-03-11 21:26:51.526852141 +0100
2c2fa1
+++ gdb-7.6.1/gdb/gdbtypes.c	2017-03-11 21:27:01.268920712 +0100
2c2fa1
@@ -2137,11 +2137,6 @@
2c2fa1
 
2c2fa1
   TYPE_NAME (type) = name;
2c2fa1
 
2c2fa1
-  /* C++ fancies.  */
2c2fa1
-
2c2fa1
-  if (name && strcmp (name, "char") == 0)
2c2fa1
-    TYPE_NOSIGN (type) = 1;
2c2fa1
-
2c2fa1
   return type;
2c2fa1
 }
2c2fa1
 
2c2fa1
@@ -4060,8 +4055,6 @@
2c2fa1
   t = arch_type (gdbarch, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name);
2c2fa1
   if (unsigned_p)
2c2fa1
     TYPE_UNSIGNED (t) = 1;
2c2fa1
-  if (name && strcmp (name, "char") == 0)
2c2fa1
-    TYPE_NOSIGN (t) = 1;
2c2fa1
 
2c2fa1
   return t;
2c2fa1
 }
2c2fa1
@@ -4305,6 +4298,7 @@
2c2fa1
   builtin_type->builtin_char
2c2fa1
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
2c2fa1
 			 !gdbarch_char_signed (gdbarch), "char");
2c2fa1
+  TYPE_NOSIGN (builtin_type->builtin_char) = 1;
2c2fa1
   builtin_type->builtin_signed_char
2c2fa1
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
2c2fa1
 			 0, "signed char");
2c2fa1
@@ -4448,6 +4442,7 @@
2c2fa1
   objfile_type->builtin_char
2c2fa1
     = init_integer_type (objfile, TARGET_CHAR_BIT,
2c2fa1
 			 !gdbarch_char_signed (gdbarch), "char");
2c2fa1
+  TYPE_NOSIGN (objfile_type->builtin_char) = 1;
2c2fa1
   objfile_type->builtin_signed_char
2c2fa1
     = init_integer_type (objfile, TARGET_CHAR_BIT,
2c2fa1
 			 0, "signed char");
2c2fa1
Index: gdb-7.6.1/gdb/mdebugread.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/mdebugread.c	2017-03-11 21:26:51.527852149 +0100
2c2fa1
+++ gdb-7.6.1/gdb/mdebugread.c	2017-03-11 21:27:01.269920719 +0100
2c2fa1
@@ -1380,6 +1380,7 @@
2c2fa1
 
2c2fa1
     case btChar:
2c2fa1
       tp = init_integer_type (objfile, 8, 0, "char");
2c2fa1
+      TYPE_NOSIGN (tp) = 1;
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btUChar:
2c2fa1
Index: gdb-7.6.1/gdb/stabsread.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/stabsread.c	2017-03-11 21:26:51.529852163 +0100
2c2fa1
+++ gdb-7.6.1/gdb/stabsread.c	2017-03-11 21:27:01.271920733 +0100
2c2fa1
@@ -2102,6 +2102,7 @@
2c2fa1
       break;
2c2fa1
     case 2:
2c2fa1
       rettype = init_integer_type (objfile, 8, 0, "char");
2c2fa1
+      TYPE_NOSIGN (rettype) = 1;
2c2fa1
       break;
2c2fa1
     case 3:
2c2fa1
       rettype = init_integer_type (objfile, 16, 0, "short");