Blame SOURCES/gdb-rhbz1320945-float128-2of9.patch

01917d
commit ae438bc5c06b770c00f37e4ed244707ce3ab9ff4
01917d
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
01917d
Date:   Tue Sep 6 17:25:31 2016 +0200
01917d
01917d
    Fix TYPE_SPECIFIC_FIELD for types created via arch_type
01917d
    
01917d
    A type's TYPE_SPECIFIC_FIELD is supposed to be initialized as appropriate
01917d
    for the type code.  This does happen if the type is created via init_type,
01917d
    but not if it created via arch_type.
01917d
    
01917d
    Fixed by extracting the initialization logic into a new set_type_code
01917d
    routine, which is then called from both places.
01917d
    
01917d
    gdb/ChangeLog:
01917d
    
01917d
            * gdbtypes.c (set_type_code): New function.
01917d
            (init_type, arch_type): Use it.
01917d
    
01917d
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
01917d
01917d
### a/gdb/ChangeLog
01917d
### b/gdb/ChangeLog
01917d
## -1,5 +1,10 @@
01917d
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
01917d
 
01917d
+	* gdbtypes.c (set_type_code): New function.
01917d
+	(init_type, arch_type): Use it.
01917d
+
01917d
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
01917d
+
01917d
 	* ada-lang.c (ada_language_arch_info): Use gdbarch_long_double_bit
01917d
 	instead of gdbarch_double_bit for "long_long_float".
01917d
 
01917d
--- a/gdb/gdbtypes.c
01917d
+++ b/gdb/gdbtypes.c
01917d
@@ -2681,6 +2681,30 @@ allocate_gnat_aux_type (struct type *type)
01917d
   *(TYPE_GNAT_SPECIFIC (type)) = gnat_aux_default;
01917d
 }
01917d
 
01917d
+/* Helper function to initialize a newly allocated type.  Set type code
01917d
+   to CODE and initialize the type-specific fields accordingly.  */
01917d
+
01917d
+static void
01917d
+set_type_code (struct type *type, enum type_code code)
01917d
+{
01917d
+  TYPE_CODE (type) = code;
01917d
+
01917d
+  switch (code)
01917d
+    {
01917d
+      case TYPE_CODE_STRUCT:
01917d
+      case TYPE_CODE_UNION:
01917d
+      case TYPE_CODE_NAMESPACE:
01917d
+        INIT_CPLUS_SPECIFIC (type);
01917d
+        break;
01917d
+      case TYPE_CODE_FLT:
01917d
+        TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
01917d
+        break;
01917d
+      case TYPE_CODE_FUNC:
01917d
+	INIT_FUNC_SPECIFIC (type);
01917d
+        break;
01917d
+    }
01917d
+}
01917d
+
01917d
 /* Helper function to initialize the standard scalar types.
01917d
 
01917d
    If NAME is non-NULL, then it is used to initialize the type name.
01917d
@@ -2694,7 +2718,7 @@ init_type (enum type_code code, int length, int flags,
01917d
   struct type *type;
01917d
 
01917d
   type = alloc_type (objfile);
01917d
-  TYPE_CODE (type) = code;
01917d
+  set_type_code (type, code);
01917d
   TYPE_LENGTH (type) = length;
01917d
 
01917d
   gdb_assert (!(flags & (TYPE_FLAG_MIN - 1)));
01917d
@@ -2730,20 +2754,6 @@ init_type (enum type_code code, int length, int flags,
01917d
   if (name && strcmp (name, "char") == 0)
01917d
     TYPE_NOSIGN (type) = 1;
01917d
 
01917d
-  switch (code)
01917d
-    {
01917d
-      case TYPE_CODE_STRUCT:
01917d
-      case TYPE_CODE_UNION:
01917d
-      case TYPE_CODE_NAMESPACE:
01917d
-        INIT_CPLUS_SPECIFIC (type);
01917d
-        break;
01917d
-      case TYPE_CODE_FLT:
01917d
-        TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
01917d
-        break;
01917d
-      case TYPE_CODE_FUNC:
01917d
-	INIT_FUNC_SPECIFIC (type);
01917d
-        break;
01917d
-    }
01917d
   return type;
01917d
 }
01917d
 
01917d
@@ -4634,7 +4644,7 @@ arch_type (struct gdbarch *gdbarch,
01917d
   struct type *type;
01917d
 
01917d
   type = alloc_type_arch (gdbarch);
01917d
-  TYPE_CODE (type) = code;
01917d
+  set_type_code (type, code);
01917d
   TYPE_LENGTH (type) = length;
01917d
 
01917d
   if (name)