2c2fa1
commit 49f190bcb7f074ea2e27d4e967e4fae9ed7dafb6
2c2fa1
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
Date:   Tue Sep 6 17:31:03 2016 +0200
2c2fa1
2c2fa1
    Add missing format for built-in floating-point types
2c2fa1
    
2c2fa1
    Many callers of init_float_type and arch_float_type still pass a NULL
2c2fa1
    floatformat.  This commit changes those callers where the floatformat
2c2fa1
    that is supposed to be use is obvious.  There are two categories where
2c2fa1
    this is the case:
2c2fa1
    
2c2fa1
    - A number of built-in types are intended to match the platform ABI
2c2fa1
      floating-point types (i.e. types that use gdbarch_float_bit etc.).
2c2fa1
      Those places should use the platform ABI floating-point formats
2c2fa1
      defined via gdbarch_float_format etc.
2c2fa1
    
2c2fa1
    - A number of language built-in types should simply use IEEE floating-
2c2fa1
      point formats, since the language actually defines that this is the
2c2fa1
      format that must be used to implement floating-point types for this
2c2fa1
      language.  (This affects Java, Go, and Rust.)  The same applies for
2c2fa1
      to the predefined "RS/6000" stabs floating-point built-in types.
2c2fa1
    
2c2fa1
    gdb/ChangeLog:
2c2fa1
    
2c2fa1
            * ada-lang.c (ada_language_arch_info): Use gdbarch-provided
2c2fa1
            platform ABI floating-point formats for built-in types.
2c2fa1
            * d-lang.c (build_d_types): Likewise.
2c2fa1
            * f-lang.c (build_fortran_types): Likewise.
2c2fa1
            * m2-lang.c (build_m2_types): Likewise.
2c2fa1
            * mdebugread.c (basic_type): Likewise.
2c2fa1
    
2c2fa1
            * go-lang.c (build_go_types): Use IEEE floating-point formats
2c2fa1
            for language built-in types as mandanted by the language.
2c2fa1
            * jv-lang.c (build_java_types): Likewise.
2c2fa1
            * rust-lang.c (rust_language_arch_info): 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,20 @@
2c2fa1
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
 
2c2fa1
+	* ada-lang.c (ada_language_arch_info): Use gdbarch-provided
2c2fa1
+	platform ABI floating-point formats for built-in types.
2c2fa1
+	* d-lang.c (build_d_types): Likewise.
2c2fa1
+	* f-lang.c (build_fortran_types): Likewise.
2c2fa1
+	* m2-lang.c (build_m2_types): Likewise.
2c2fa1
+	* mdebugread.c (basic_type): Likewise.
2c2fa1
+
2c2fa1
+	* go-lang.c (build_go_types): Use IEEE floating-point formats
2c2fa1
+	for language built-in types as mandanted by the language.
2c2fa1
+	* jv-lang.c (build_java_types): Likewise.
2c2fa1
+	* rust-lang.c (rust_language_arch_info): Likewise.
2c2fa1
+	* stabsread.c (rs6000_builtin_type): Likewise.
2c2fa1
+
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
Index: gdb-7.6.1/gdb/ada-lang.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/ada-lang.c	2017-03-11 21:30:58.630560198 +0100
2c2fa1
+++ gdb-7.6.1/gdb/ada-lang.c	2017-03-11 21:31:01.661580871 +0100
2c2fa1
@@ -12666,16 +12666,16 @@
2c2fa1
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "character");
2c2fa1
   lai->primitive_type_vector [ada_primitive_type_float]
2c2fa1
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
2c2fa1
-		       "float", NULL);
2c2fa1
+		       "float", gdbarch_float_format (gdbarch));
2c2fa1
   lai->primitive_type_vector [ada_primitive_type_double]
2c2fa1
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
2c2fa1
-		       "long_float", NULL);
2c2fa1
+		       "long_float", gdbarch_double_format (gdbarch));
2c2fa1
   lai->primitive_type_vector [ada_primitive_type_long_long]
2c2fa1
     = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
2c2fa1
 			 0, "long_long_integer");
2c2fa1
   lai->primitive_type_vector [ada_primitive_type_long_double]
2c2fa1
     = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
2c2fa1
-		       "long_long_float", NULL);
2c2fa1
+		       "long_long_float", gdbarch_long_double_format (gdbarch));
2c2fa1
   lai->primitive_type_vector [ada_primitive_type_natural]
2c2fa1
     = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
2c2fa1
 			 0, "natural");
2c2fa1
Index: gdb-7.6.1/gdb/f-lang.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/f-lang.c	2017-03-11 21:30:58.631560204 +0100
2c2fa1
+++ gdb-7.6.1/gdb/f-lang.c	2017-03-11 21:31:01.662580878 +0100
2c2fa1
@@ -312,13 +312,13 @@
2c2fa1
 
2c2fa1
   builtin_f_type->builtin_real
2c2fa1
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
2c2fa1
-		       "real", NULL);
2c2fa1
+		       "real", gdbarch_float_format (gdbarch));
2c2fa1
   builtin_f_type->builtin_real_s8
2c2fa1
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
2c2fa1
-		       "real*8", NULL);
2c2fa1
+		       "real*8", gdbarch_double_format (gdbarch));
2c2fa1
   builtin_f_type->builtin_real_s16
2c2fa1
     = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
2c2fa1
-		       "real*16", NULL);
2c2fa1
+		       "real*16", gdbarch_long_double_format (gdbarch));
2c2fa1
 
2c2fa1
   builtin_f_type->builtin_complex_s8
2c2fa1
     = arch_complex_type (gdbarch, "complex*8",
2c2fa1
Index: gdb-7.6.1/gdb/go-lang.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/go-lang.c	2017-03-11 21:30:58.632560211 +0100
2c2fa1
+++ gdb-7.6.1/gdb/go-lang.c	2017-03-11 21:31:01.662580878 +0100
2c2fa1
@@ -634,9 +634,9 @@
2c2fa1
   builtin_go_type->builtin_uint64
2c2fa1
     = arch_integer_type (gdbarch, 64, 1, "uint64");
2c2fa1
   builtin_go_type->builtin_float32
2c2fa1
-    = arch_float_type (gdbarch, 32, "float32", NULL);
2c2fa1
+    = arch_float_type (gdbarch, 32, "float32", floatformats_ieee_single);
2c2fa1
   builtin_go_type->builtin_float64
2c2fa1
-    = arch_float_type (gdbarch, 64, "float64", NULL);
2c2fa1
+    = arch_float_type (gdbarch, 64, "float64", floatformats_ieee_double);
2c2fa1
   builtin_go_type->builtin_complex64
2c2fa1
     = arch_complex_type (gdbarch, "complex64",
2c2fa1
 			 builtin_go_type->builtin_float32);
2c2fa1
Index: gdb-7.6.1/gdb/jv-lang.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/jv-lang.c	2017-03-11 21:30:58.632560211 +0100
2c2fa1
+++ gdb-7.6.1/gdb/jv-lang.c	2017-03-11 21:31:01.662580878 +0100
2c2fa1
@@ -1220,9 +1220,9 @@
2c2fa1
   builtin_java_type->builtin_char
2c2fa1
     = arch_character_type (gdbarch, 16, 1, "char");
2c2fa1
   builtin_java_type->builtin_float
2c2fa1
-    = arch_float_type (gdbarch, 32, "float", NULL);
2c2fa1
+    = arch_float_type (gdbarch, 32, "float", floatformats_ieee_single);
2c2fa1
   builtin_java_type->builtin_double
2c2fa1
-    = arch_float_type (gdbarch, 64, "double", NULL);
2c2fa1
+    = arch_float_type (gdbarch, 64, "double", floatformats_ieee_double);
2c2fa1
   builtin_java_type->builtin_void
2c2fa1
     = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");
2c2fa1
 
2c2fa1
Index: gdb-7.6.1/gdb/m2-lang.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/m2-lang.c	2017-03-11 21:30:58.633560218 +0100
2c2fa1
+++ gdb-7.6.1/gdb/m2-lang.c	2017-03-11 21:31:01.662580878 +0100
2c2fa1
@@ -406,7 +406,8 @@
2c2fa1
   builtin_m2_type->builtin_card
2c2fa1
     = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "CARDINAL");
2c2fa1
   builtin_m2_type->builtin_real
2c2fa1
-    = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", NULL);
2c2fa1
+    = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL",
2c2fa1
+		       gdbarch_float_format (gdbarch));
2c2fa1
   builtin_m2_type->builtin_char
2c2fa1
     = arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "CHAR");
2c2fa1
   builtin_m2_type->builtin_bool
2c2fa1
Index: gdb-7.6.1/gdb/mdebugread.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/mdebugread.c	2017-03-11 21:30:58.634560225 +0100
2c2fa1
+++ gdb-7.6.1/gdb/mdebugread.c	2017-03-11 21:31:01.664580891 +0100
2c2fa1
@@ -1413,12 +1413,12 @@
2c2fa1
 
2c2fa1
     case btFloat:
2c2fa1
       tp = init_float_type (objfile, gdbarch_float_bit (gdbarch),
2c2fa1
-			    "float", NULL);
2c2fa1
+			    "float", gdbarch_float_format (gdbarch));
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btDouble:
2c2fa1
       tp = init_float_type (objfile, gdbarch_double_bit (gdbarch),
2c2fa1
-			    "double", NULL);
2c2fa1
+			    "double", gdbarch_double_format (gdbarch));
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btComplex:
2c2fa1
Index: gdb-7.6.1/gdb/stabsread.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/stabsread.c	2017-03-11 21:30:58.636560239 +0100
2c2fa1
+++ gdb-7.6.1/gdb/stabsread.c	2017-03-11 21:31:01.665580898 +0100
2c2fa1
@@ -2133,17 +2133,20 @@
2c2fa1
       break;
2c2fa1
     case 12:
2c2fa1
       /* IEEE single precision (32 bit).  */
2c2fa1
-      rettype = init_float_type (objfile, 32, "float", NULL);
2c2fa1
+      rettype = init_float_type (objfile, 32, "float",
2c2fa1
+				 floatformats_ieee_single);
2c2fa1
       break;
2c2fa1
     case 13:
2c2fa1
       /* IEEE double precision (64 bit).  */
2c2fa1
-      rettype = init_float_type (objfile, 64, "double", NULL);
2c2fa1
+      rettype = init_float_type (objfile, 64, "double",
2c2fa1
+				 floatformats_ieee_double);
2c2fa1
       break;
2c2fa1
     case 14:
2c2fa1
       /* This is an IEEE double on the RS/6000, and different machines with
2c2fa1
          different sizes for "long double" should use different negative
2c2fa1
          type numbers.  See stabs.texinfo.  */
2c2fa1
-      rettype = init_float_type (objfile, 64, "long double", NULL);
2c2fa1
+      rettype = init_float_type (objfile, 64, "long double",
2c2fa1
+				 floatformats_ieee_double);
2c2fa1
       break;
2c2fa1
     case 15:
2c2fa1
       rettype = init_integer_type (objfile, 32, 0, "integer");
2c2fa1
@@ -2152,10 +2155,12 @@
2c2fa1
       rettype = init_boolean_type (objfile, 32, 1, "boolean");
2c2fa1
       break;
2c2fa1
     case 17:
2c2fa1
-      rettype = init_float_type (objfile, 32, "short real", NULL);
2c2fa1
+      rettype = init_float_type (objfile, 32, "short real",
2c2fa1
+				 floatformats_ieee_single);
2c2fa1
       break;
2c2fa1
     case 18:
2c2fa1
-      rettype = init_float_type (objfile, 64, "real", NULL);
2c2fa1
+      rettype = init_float_type (objfile, 64, "real",
2c2fa1
+				 floatformats_ieee_double);
2c2fa1
       break;
2c2fa1
     case 19:
2c2fa1
       rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");