This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Add missing format for built-in floating-point types


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=49f190bcb7f074ea2e27d4e967e4fae9ed7dafb6

commit 49f190bcb7f074ea2e27d4e967e4fae9ed7dafb6
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date:   Tue Sep 6 17:31:03 2016 +0200

    Add missing format for built-in floating-point types
    
    Many callers of init_float_type and arch_float_type still pass a NULL
    floatformat.  This commit changes those callers where the floatformat
    that is supposed to be use is obvious.  There are two categories where
    this is the case:
    
    - A number of built-in types are intended to match the platform ABI
      floating-point types (i.e. types that use gdbarch_float_bit etc.).
      Those places should use the platform ABI floating-point formats
      defined via gdbarch_float_format etc.
    
    - A number of language built-in types should simply use IEEE floating-
      point formats, since the language actually defines that this is the
      format that must be used to implement floating-point types for this
      language.  (This affects Java, Go, and Rust.)  The same applies for
      to the predefined "RS/6000" stabs floating-point built-in types.
    
    gdb/ChangeLog:
    
    	* ada-lang.c (ada_language_arch_info): Use gdbarch-provided
    	platform ABI floating-point formats for built-in types.
    	* d-lang.c (build_d_types): Likewise.
    	* f-lang.c (build_fortran_types): Likewise.
    	* m2-lang.c (build_m2_types): Likewise.
    	* mdebugread.c (basic_type): Likewise.
    
    	* go-lang.c (build_go_types): Use IEEE floating-point formats
    	for language built-in types as mandanted by the language.
    	* jv-lang.c (build_java_types): Likewise.
    	* rust-lang.c (rust_language_arch_info): Likewise.
    	* stabsread.c (rs6000_builtin_type): Likewise.
    
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>

Diff:
---
 gdb/ChangeLog    | 15 +++++++++++++++
 gdb/ada-lang.c   |  6 +++---
 gdb/d-lang.c     | 12 ++++++------
 gdb/f-lang.c     |  6 +++---
 gdb/go-lang.c    |  4 ++--
 gdb/jv-lang.c    |  4 ++--
 gdb/m2-lang.c    |  3 ++-
 gdb/mdebugread.c |  4 ++--
 gdb/rust-lang.c  |  6 ++++--
 gdb/stabsread.c  | 15 ++++++++++-----
 10 files changed, 49 insertions(+), 26 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5db0f66..1dbddac 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
 
+	* ada-lang.c (ada_language_arch_info): Use gdbarch-provided
+	platform ABI floating-point formats for built-in types.
+	* d-lang.c (build_d_types): Likewise.
+	* f-lang.c (build_fortran_types): Likewise.
+	* m2-lang.c (build_m2_types): Likewise.
+	* mdebugread.c (basic_type): Likewise.
+
+	* go-lang.c (build_go_types): Use IEEE floating-point formats
+	for language built-in types as mandanted by the language.
+	* jv-lang.c (build_java_types): Likewise.
+	* rust-lang.c (rust_language_arch_info): Likewise.
+	* stabsread.c (rs6000_builtin_type): Likewise.
+
+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.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b8cc982..be2f47a 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -14004,16 +14004,16 @@ ada_language_arch_info (struct gdbarch *gdbarch,
     = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "character");
   lai->primitive_type_vector [ada_primitive_type_float]
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
-		       "float", NULL);
+		       "float", gdbarch_float_format (gdbarch));
   lai->primitive_type_vector [ada_primitive_type_double]
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
-		       "long_float", NULL);
+		       "long_float", gdbarch_double_format (gdbarch));
   lai->primitive_type_vector [ada_primitive_type_long_long]
     = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
 			 0, "long_long_integer");
   lai->primitive_type_vector [ada_primitive_type_long_double]
     = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
-		       "long_long_float", NULL);
+		       "long_long_float", gdbarch_long_double_format (gdbarch));
   lai->primitive_type_vector [ada_primitive_type_natural]
     = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
 			 0, "natural");
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 2eb7ffa..5fbc242 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -287,13 +287,13 @@ build_d_types (struct gdbarch *gdbarch)
     = arch_integer_type (gdbarch, 128, 1, "ucent");
   builtin_d_type->builtin_float
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
-		       "float", NULL);
+		       "float", gdbarch_float_format (gdbarch));
   builtin_d_type->builtin_double
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
-		       "double", NULL);
+		       "double", gdbarch_double_format (gdbarch));
   builtin_d_type->builtin_real
     = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
-		       "real", NULL);
+		       "real", gdbarch_long_double_format (gdbarch));
 
   TYPE_INSTANCE_FLAGS (builtin_d_type->builtin_byte)
     |= TYPE_INSTANCE_FLAG_NOTTEXT;
@@ -303,13 +303,13 @@ build_d_types (struct gdbarch *gdbarch)
   /* Imaginary and complex types.  */
   builtin_d_type->builtin_ifloat
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
-		       "ifloat", NULL);
+		       "ifloat", gdbarch_float_format (gdbarch));
   builtin_d_type->builtin_idouble
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
-		       "idouble", NULL);
+		       "idouble", gdbarch_double_format (gdbarch));
   builtin_d_type->builtin_ireal
     = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
-		       "ireal", NULL);
+		       "ireal", gdbarch_long_double_format (gdbarch));
   builtin_d_type->builtin_cfloat
     = arch_complex_type (gdbarch, "cfloat",
 			 builtin_d_type->builtin_float);
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 58f58dd..29fdb3b 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -332,13 +332,13 @@ build_fortran_types (struct gdbarch *gdbarch)
 
   builtin_f_type->builtin_real
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
-		       "real", NULL);
+		       "real", gdbarch_float_format (gdbarch));
   builtin_f_type->builtin_real_s8
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
-		       "real*8", NULL);
+		       "real*8", gdbarch_double_format (gdbarch));
   builtin_f_type->builtin_real_s16
     = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
-		       "real*16", NULL);
+		       "real*16", gdbarch_long_double_format (gdbarch));
 
   builtin_f_type->builtin_complex_s8
     = arch_complex_type (gdbarch, "complex*8",
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 0a0101d..4fba8a0 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -648,9 +648,9 @@ build_go_types (struct gdbarch *gdbarch)
   builtin_go_type->builtin_uint64
     = arch_integer_type (gdbarch, 64, 1, "uint64");
   builtin_go_type->builtin_float32
-    = arch_float_type (gdbarch, 32, "float32", NULL);
+    = arch_float_type (gdbarch, 32, "float32", floatformats_ieee_single);
   builtin_go_type->builtin_float64
-    = arch_float_type (gdbarch, 64, "float64", NULL);
+    = arch_float_type (gdbarch, 64, "float64", floatformats_ieee_double);
   builtin_go_type->builtin_complex64
     = arch_complex_type (gdbarch, "complex64",
 			 builtin_go_type->builtin_float32);
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index bc2fc62..6bf72b9 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -1241,9 +1241,9 @@ build_java_types (struct gdbarch *gdbarch)
   builtin_java_type->builtin_char
     = arch_character_type (gdbarch, 16, 1, "char");
   builtin_java_type->builtin_float
-    = arch_float_type (gdbarch, 32, "float", NULL);
+    = arch_float_type (gdbarch, 32, "float", floatformats_ieee_single);
   builtin_java_type->builtin_double
-    = arch_float_type (gdbarch, 64, "double", NULL);
+    = arch_float_type (gdbarch, 64, "double", floatformats_ieee_double);
   builtin_java_type->builtin_void
     = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");
 
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 67d0f6b..afe2117 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -413,7 +413,8 @@ build_m2_types (struct gdbarch *gdbarch)
   builtin_m2_type->builtin_card
     = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "CARDINAL");
   builtin_m2_type->builtin_real
-    = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", NULL);
+    = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL",
+		       gdbarch_float_format (gdbarch));
   builtin_m2_type->builtin_char
     = arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "CHAR");
   builtin_m2_type->builtin_bool
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 336609a..157ce77 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1441,12 +1441,12 @@ basic_type (int bt, struct objfile *objfile)
 
     case btFloat:
       tp = init_float_type (objfile, gdbarch_float_bit (gdbarch),
-			    "float", NULL);
+			    "float", gdbarch_float_format (gdbarch));
       break;
 
     case btDouble:
       tp = init_float_type (objfile, gdbarch_double_bit (gdbarch),
-			    "double", NULL);
+			    "double", gdbarch_double_format (gdbarch));
       break;
 
     case btComplex:
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 481a4fc..77f7428 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1128,8 +1128,10 @@ rust_language_arch_info (struct gdbarch *gdbarch,
   types[rust_primitive_isize] = arch_integer_type (gdbarch, length, 0, "isize");
   types[rust_primitive_usize] = arch_integer_type (gdbarch, length, 1, "usize");
 
-  types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32", NULL);
-  types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64", NULL);
+  types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32",
+					       floatformats_ieee_single);
+  types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64",
+					       floatformats_ieee_double);
 
   types[rust_primitive_unit] = arch_integer_type (gdbarch, 0, 1, "()");
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 6a4734c..3bad6ac 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2133,17 +2133,20 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
       break;
     case 12:
       /* IEEE single precision (32 bit).  */
-      rettype = init_float_type (objfile, 32, "float", NULL);
+      rettype = init_float_type (objfile, 32, "float",
+				 floatformats_ieee_single);
       break;
     case 13:
       /* IEEE double precision (64 bit).  */
-      rettype = init_float_type (objfile, 64, "double", NULL);
+      rettype = init_float_type (objfile, 64, "double",
+				 floatformats_ieee_double);
       break;
     case 14:
       /* This is an IEEE double on the RS/6000, and different machines with
          different sizes for "long double" should use different negative
          type numbers.  See stabs.texinfo.  */
-      rettype = init_float_type (objfile, 64, "long double", NULL);
+      rettype = init_float_type (objfile, 64, "long double",
+				 floatformats_ieee_double);
       break;
     case 15:
       rettype = init_integer_type (objfile, 32, 0, "integer");
@@ -2152,10 +2155,12 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
       rettype = init_boolean_type (objfile, 32, 1, "boolean");
       break;
     case 17:
-      rettype = init_float_type (objfile, 32, "short real", NULL);
+      rettype = init_float_type (objfile, 32, "short real",
+				 floatformats_ieee_single);
       break;
     case 18:
-      rettype = init_float_type (objfile, 64, "real", NULL);
+      rettype = init_float_type (objfile, 64, "real",
+				 floatformats_ieee_double);
       break;
     case 19:
       rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]