This is the mail archive of the gdb-patches@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]

Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}


Ulrich Weigand wrote:
Markus Deuling wrote:

You're right :-) I took TARGET_ARCHITECTURE for now. I'll remove the comment when finishing the macro transition.

Attached is a reworked patch.

Thanks. Unfortunately the patch now conflicts with the just-applied INT_BIT patch and no longer applies.

Could you re-generate the patch, please?


Sorry. Attached is a rebased version that applies against current head :-)



-- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com

diff -urN src/gdb/ada-lang.c dev/gdb/ada-lang.c
--- src/gdb/ada-lang.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/ada-lang.c	2007-06-12 18:09:09.000000000 +0200
@@ -10287,17 +10287,18 @@
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-                        TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+                        gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
                         0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-                        TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+                        gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
                         0, "long_float", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-                        TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+                        gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
                         0, "long_long_float", objfile);
       break;
     }
@@ -10345,17 +10346,20 @@
     init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
                0, "character", (struct objfile *) NULL);
   lai->primitive_type_vector [ada_primitive_type_float] =
-    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_float_bit (current_gdbarch)/ TARGET_CHAR_BIT,
                0, "float", (struct objfile *) NULL);
   lai->primitive_type_vector [ada_primitive_type_double] =
-    init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
                0, "long_float", (struct objfile *) NULL);
   lai->primitive_type_vector [ada_primitive_type_long_long] =
     init_type (TYPE_CODE_INT, 
 	       gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
                0, "long_long_integer", (struct objfile *) NULL);
   lai->primitive_type_vector [ada_primitive_type_long_double] =
-    init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
                0, "long_long_float", (struct objfile *) NULL);
   lai->primitive_type_vector [ada_primitive_type_natural] =
     init_type (TYPE_CODE_INT,
diff -urN src/gdb/ada-lex.l dev/gdb/ada-lex.l
--- src/gdb/ada-lex.l	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/ada-lex.l	2007-06-12 18:07:23.000000000 +0200
@@ -376,9 +376,11 @@
   sscanf (num0, DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
 
   yylval.typed_val_float.type = type_float ();
-  if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT)
+  if (sizeof(DOUBLEST) >= gdbarch_double_bit (current_gdbarch)
+			    / TARGET_CHAR_BIT)
     yylval.typed_val_float.type = type_double ();
-  if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT)
+  if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (current_gdbarch)
+			    / TARGET_CHAR_BIT)
     yylval.typed_val_float.type = type_long_double ();
 
   return FLOAT;
diff -urN src/gdb/c-lang.c dev/gdb/c-lang.c
--- src/gdb/c-lang.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/c-lang.c	2007-06-12 18:07:23.000000000 +0200
@@ -313,41 +313,49 @@
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "long double", objfile);
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_FLT,
-			2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_float_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "complex float", objfile);
       TYPE_TARGET_TYPE (type)
-	= init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+	= init_type (TYPE_CODE_FLT,
+		     gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 		     0, "float", objfile);
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_FLT,
-			2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "complex double", objfile);
       TYPE_TARGET_TYPE (type)
-	= init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+	= init_type (TYPE_CODE_FLT,
+		     gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 		     0, "double", objfile);
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_FLT,
-			2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "complex long double", objfile);
       TYPE_TARGET_TYPE (type)
-	= init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+	= init_type (TYPE_CODE_FLT,
+		     gdbarch_long_double_bit (current_gdbarch)
+		       / TARGET_CHAR_BIT,
 		     0, "long double", objfile);
       break;
     case FT_TEMPLATE_ARG:
diff -urN src/gdb/cris-tdep.c dev/gdb/cris-tdep.c
--- src/gdb/cris-tdep.c	2007-05-31 19:31:37.000000000 +0200
+++ dev/gdb/cris-tdep.c	2007-06-12 18:07:23.000000000 +0200
@@ -4107,7 +4107,7 @@
      register is.  */
 
   set_gdbarch_double_bit (gdbarch, 64);
-  /* The default definition of a long double is 2 * TARGET_DOUBLE_BIT,
+  /* The default definition of a long double is 2 * gdbarch_double_bit,
      which means we have to set this explicitly.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
 
diff -urN src/gdb/doublest.c dev/gdb/doublest.c
--- src/gdb/doublest.c	2007-05-31 19:11:18.000000000 +0200
+++ dev/gdb/doublest.c	2007-06-12 18:07:23.000000000 +0200
@@ -724,20 +724,24 @@
 floatformat_from_length (int len)
 {
   const struct floatformat *format;
-  if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
-    format = TARGET_FLOAT_FORMAT[gdbarch_byte_order (current_gdbarch)];
-  else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
-    format = TARGET_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)];
-  else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
-    format = TARGET_LONG_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)];
+  if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch))
+    format = gdbarch_float_format (current_gdbarch)
+	       [gdbarch_byte_order (current_gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch))
+    format = gdbarch_double_format (current_gdbarch)
+	       [gdbarch_byte_order (current_gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch))
+    format = gdbarch_long_double_format (current_gdbarch)
+	       [gdbarch_byte_order (current_gdbarch)];
   /* On i386 the 'long double' type takes 96 bits,
      while the real number of used bits is only 80,
      both in processor and in memory.  
      The code below accepts the real bit size.  */ 
-  else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) 
+  else if ((gdbarch_long_double_format (current_gdbarch) != NULL) 
 	   && (len * TARGET_CHAR_BIT ==
-               TARGET_LONG_DOUBLE_FORMAT[0]->totalsize))
-    format = TARGET_LONG_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)];
+               gdbarch_long_double_format (current_gdbarch)[0]->totalsize))
+    format = gdbarch_long_double_format (current_gdbarch)
+	       [gdbarch_byte_order (current_gdbarch)];
   else
     format = NULL;
   if (format == NULL)
diff -urN src/gdb/f-lang.c dev/gdb/f-lang.c
--- src/gdb/f-lang.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/f-lang.c	2007-06-12 18:07:23.000000000 +0200
@@ -353,39 +353,42 @@
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "real", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "real*8", objfile);
       break;
     case FT_FLOAT_DECIMAL:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "floating decimal", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "real*16", objfile);
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "complex*8", objfile);
       TYPE_TARGET_TYPE (type) = builtin_type_f_real;
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "complex*16", objfile);
       TYPE_TARGET_TYPE (type) = builtin_type_f_real_s8;
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "complex*32", objfile);
       TYPE_TARGET_TYPE (type) = builtin_type_f_real_s16;
       break;
@@ -531,28 +534,33 @@
 	       TYPE_FLAG_UNSIGNED, "logical*4", (struct objfile *) NULL);
 
   builtin_type_f_real =
-    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "real", (struct objfile *) NULL);
 
   builtin_type_f_real_s8 =
-    init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "real*8", (struct objfile *) NULL);
 
   builtin_type_f_real_s16 =
-    init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_long_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "real*16", (struct objfile *) NULL);
 
   builtin_type_f_complex_s8 =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "complex*8", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_f_complex_s8) = builtin_type_f_real;
 
   builtin_type_f_complex_s16 =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "complex*16", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_f_complex_s16) = builtin_type_f_real_s8;
@@ -561,7 +569,8 @@
      complex*32 data type */
 
   builtin_type_f_complex_s32 =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_long_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "complex*32", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_f_complex_s32) = builtin_type_f_real_s16;
diff -urN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/gdbarch.c	2007-06-12 18:07:23.000000000 +0200
@@ -373,7 +373,7 @@
                struct gdbarch_tdep *tdep)
 {
   /* NOTE: The new architecture variable is named ``current_gdbarch''
-     so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to
+     so that macros such as TARGET_ARCHITECTURE, when expanded, refer to
      the current local architecture and not the previous global
      architecture.  This ensures that the new architectures initial
      values are not influenced by the previous architecture.  Once
@@ -850,19 +850,9 @@
   fprintf_unfiltered (file,
                       "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n",
                       (long) current_gdbarch->deprecated_use_struct_convention);
-#ifdef TARGET_DOUBLE_BIT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n",
-                      XSTRING (TARGET_DOUBLE_BIT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: double_bit = %s\n",
                       paddr_d (current_gdbarch->double_bit));
-#ifdef TARGET_DOUBLE_FORMAT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_DOUBLE_FORMAT # %s\n",
-                      XSTRING (TARGET_DOUBLE_FORMAT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: double_format = %s\n",
                       pformat (current_gdbarch->double_format));
@@ -917,19 +907,9 @@
   fprintf_unfiltered (file,
                       "gdbarch_dump: fetch_tls_load_module_address = <0x%lx>\n",
                       (long) current_gdbarch->fetch_tls_load_module_address);
-#ifdef TARGET_FLOAT_BIT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_FLOAT_BIT # %s\n",
-                      XSTRING (TARGET_FLOAT_BIT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: float_bit = %s\n",
                       paddr_d (current_gdbarch->float_bit));
-#ifdef TARGET_FLOAT_FORMAT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_FLOAT_FORMAT # %s\n",
-                      XSTRING (TARGET_FLOAT_FORMAT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: float_format = %s\n",
                       pformat (current_gdbarch->float_format));
@@ -989,19 +969,9 @@
   fprintf_unfiltered (file,
                       "gdbarch_dump: long_bit = %s\n",
                       paddr_d (current_gdbarch->long_bit));
-#ifdef TARGET_LONG_DOUBLE_BIT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n",
-                      XSTRING (TARGET_LONG_DOUBLE_BIT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: long_double_bit = %s\n",
                       paddr_d (current_gdbarch->long_double_bit));
-#ifdef TARGET_LONG_DOUBLE_FORMAT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n",
-                      XSTRING (TARGET_LONG_DOUBLE_FORMAT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: long_double_format = %s\n",
                       pformat (current_gdbarch->long_double_format));
diff -urN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/gdbarch.h	2007-06-12 18:07:23.000000000 +0200
@@ -112,57 +112,21 @@
 
 extern int gdbarch_float_bit (struct gdbarch *gdbarch);
 extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
-#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_BIT)
-#error "Non multi-arch definition of TARGET_FLOAT_BIT"
-#endif
-#if !defined (TARGET_FLOAT_BIT)
-#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch))
-#endif
 
 extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch);
 extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format);
-#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_FORMAT)
-#error "Non multi-arch definition of TARGET_FLOAT_FORMAT"
-#endif
-#if !defined (TARGET_FLOAT_FORMAT)
-#define TARGET_FLOAT_FORMAT (gdbarch_float_format (current_gdbarch))
-#endif
 
 extern int gdbarch_double_bit (struct gdbarch *gdbarch);
 extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
-#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_BIT)
-#error "Non multi-arch definition of TARGET_DOUBLE_BIT"
-#endif
-#if !defined (TARGET_DOUBLE_BIT)
-#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch))
-#endif
 
 extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch);
 extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format);
-#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_FORMAT)
-#error "Non multi-arch definition of TARGET_DOUBLE_FORMAT"
-#endif
-#if !defined (TARGET_DOUBLE_FORMAT)
-#define TARGET_DOUBLE_FORMAT (gdbarch_double_format (current_gdbarch))
-#endif
 
 extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
 extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
-#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_BIT)
-#error "Non multi-arch definition of TARGET_LONG_DOUBLE_BIT"
-#endif
-#if !defined (TARGET_LONG_DOUBLE_BIT)
-#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch))
-#endif
 
 extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch);
 extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format);
-#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_FORMAT)
-#error "Non multi-arch definition of TARGET_LONG_DOUBLE_FORMAT"
-#endif
-#if !defined (TARGET_LONG_DOUBLE_FORMAT)
-#define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch))
-#endif
 
 /* For most targets, a pointer on the target and its representation as an
    address in GDB have the same size and "look the same".  For such a
diff -urN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/gdbarch.sh	2007-06-12 18:07:23.000000000 +0200
@@ -394,12 +394,12 @@
 # Each format describes both the big and little endian layouts (if
 # useful).
 
-v:TARGET_FLOAT_BIT:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0
-v:TARGET_FLOAT_FORMAT:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (current_gdbarch->float_format)
-v:TARGET_DOUBLE_BIT:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0
-v:TARGET_DOUBLE_FORMAT:const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (current_gdbarch->double_format)
-v:TARGET_LONG_DOUBLE_BIT:int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
-v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (current_gdbarch->long_double_format)
+v::int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0
+v::const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (current_gdbarch->float_format)
+v::int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0
+v::const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (current_gdbarch->double_format)
+v::int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
+v::const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (current_gdbarch->long_double_format)
 
 # For most targets, a pointer on the target and its representation as an
 # address in GDB have the same size and "look the same".  For such a
@@ -1348,7 +1348,7 @@
                struct gdbarch_tdep *tdep)
 {
   /* NOTE: The new architecture variable is named \`\`current_gdbarch''
-     so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to
+     so that macros such as gdbarch_double_bit, when expanded, refer to
      the current local architecture and not the previous global
      architecture.  This ensures that the new architectures initial
      values are not influenced by the previous architecture.  Once
diff -urN src/gdb/gdbtypes.c dev/gdb/gdbtypes.c
--- src/gdb/gdbtypes.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/gdbtypes.c	2007-06-12 18:11:33.000000000 +0200
@@ -3466,20 +3466,27 @@
 	       gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       TYPE_FLAG_UNSIGNED, 
 	       "unsigned long long", (struct objfile *) NULL);
-  builtin_type_float = build_flt (TARGET_FLOAT_BIT, "float",
-				  TARGET_FLOAT_FORMAT);
-  builtin_type_double = build_flt (TARGET_DOUBLE_BIT, "double",
-				   TARGET_DOUBLE_FORMAT);
-  builtin_type_long_double = build_flt (TARGET_LONG_DOUBLE_BIT, "long double",
-					TARGET_LONG_DOUBLE_FORMAT);
+
+  builtin_type_float
+    = build_flt (gdbarch_float_bit (current_gdbarch), "float",
+				    gdbarch_float_format (current_gdbarch));
+  builtin_type_double
+    = build_flt (gdbarch_double_bit (current_gdbarch), "double",
+				     gdbarch_double_format (current_gdbarch));
+  builtin_type_long_double
+    = build_flt (gdbarch_long_double_bit (current_gdbarch), "long double",
+					  gdbarch_long_double_format
+					    (current_gdbarch));
 
   builtin_type_complex =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_complex) = builtin_type_float;
   builtin_type_double_complex =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "double complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_double_complex) = builtin_type_double;
diff -urN src/gdb/m2-lang.c dev/gdb/m2-lang.c
--- src/gdb/m2-lang.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/m2-lang.c	2007-06-12 18:07:23.000000000 +0200
@@ -310,41 +310,45 @@
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_FLOAT_DECIMAL:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "floating decimal", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "long double", objfile);
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_float_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "complex", objfile);
       TYPE_TARGET_TYPE (type)
 	= m2_create_fundamental_type (objfile, FT_FLOAT);
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "double complex", objfile);
       TYPE_TARGET_TYPE (type)
 	= m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT);
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			2 * gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "long double complex", objfile);
       TYPE_TARGET_TYPE (type)
 	= m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT);
@@ -460,7 +464,8 @@
 	       TYPE_FLAG_UNSIGNED,
 	       "CARDINAL", (struct objfile *) NULL);
   builtin_type_m2_real =
-    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "REAL", (struct objfile *) NULL);
   builtin_type_m2_char =
diff -urN src/gdb/mdebugread.c dev/gdb/mdebugread.c
--- src/gdb/mdebugread.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/mdebugread.c	2007-06-12 18:07:23.000000000 +0200
@@ -4841,22 +4841,22 @@
 	       "adr_64", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (mdebug_type_adr_64) = mdebug_type_void;
   mdebug_type_float =
-    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-	       0,
-	       "float", (struct objfile *) NULL);
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       0, "float", (struct objfile *) NULL);
   mdebug_type_double =
-    init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-	       0,
-	       "double", (struct objfile *) NULL);
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       0, "double", (struct objfile *) NULL);
   mdebug_type_complex =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-	       0,
-	       "complex", (struct objfile *) NULL);
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       0, "complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (mdebug_type_complex) = mdebug_type_float;
   mdebug_type_double_complex =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-	       0,
-	       "double complex", (struct objfile *) NULL);
+    init_type (TYPE_CODE_COMPLEX,
+	       2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       0, "double complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (mdebug_type_double_complex) = mdebug_type_double;
 
   /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
@@ -4878,7 +4878,7 @@
 
   mdebug_type_float_dec =
     init_type (TYPE_CODE_ERROR,
-	       TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 	       0, "floating decimal",
 	       (struct objfile *) NULL);
 
diff -urN src/gdb/objc-lang.c dev/gdb/objc-lang.c
--- src/gdb/objc-lang.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/objc-lang.c	2007-06-12 18:07:23.000000000 +0200
@@ -550,17 +550,19 @@
 	break;
       case FT_FLOAT:
 	type = init_type (TYPE_CODE_FLT,
-			  TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			  gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			  0, "float", objfile);
 	break;
       case FT_DBL_PREC_FLOAT:
 	type = init_type (TYPE_CODE_FLT,
-			  TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			  gdbarch_double_bit (current_gdbarch)
+			    / TARGET_CHAR_BIT,
 			  0, "double", objfile);
 	break;
       case FT_EXT_PREC_FLOAT:
 	type = init_type (TYPE_CODE_FLT,
-			  TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			  gdbarch_long_double_bit (current_gdbarch)
+			    / TARGET_CHAR_BIT,
 			  0, "long double", objfile);
 	break;
       }
diff -urN src/gdb/p-lang.c dev/gdb/p-lang.c
--- src/gdb/p-lang.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/p-lang.c	2007-06-12 18:07:23.000000000 +0200
@@ -376,17 +376,18 @@
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (current_gdbarch)
+			  / TARGET_CHAR_BIT,
 			0, "extended", objfile);
       break;
     }
diff -urN src/gdb/valarith.c dev/gdb/valarith.c
--- src/gdb/valarith.c	2007-06-12 18:05:43.000000000 +0200
+++ dev/gdb/valarith.c	2007-06-12 18:07:23.000000000 +0200
@@ -808,8 +808,8 @@
       /* If either arg was long double, make sure that value is also long
          double.  */
 
-      if (TYPE_LENGTH (type1) * 8 > TARGET_DOUBLE_BIT
-	  || TYPE_LENGTH (type2) * 8 > TARGET_DOUBLE_BIT)
+      if (TYPE_LENGTH (type1) * 8 > gdbarch_double_bit (current_gdbarch)
+	  || TYPE_LENGTH (type2) * 8 > gdbarch_double_bit (current_gdbarch))
 	val = allocate_value (builtin_type_long_double);
       else
 	val = allocate_value (builtin_type_double);
diff -urN src/gdb/value.c dev/gdb/value.c
--- src/gdb/value.c	2007-06-11 11:31:58.000000000 +0200
+++ dev/gdb/value.c	2007-06-12 18:07:24.000000000 +0200
@@ -1138,7 +1138,7 @@
 	 only in a non-portable way.  Fixing the portability problem
 	 wouldn't help since the VAX floating-point code is also badly
 	 bit-rotten.  The target needs to add definitions for the
-	 methods TARGET_FLOAT_FORMAT and TARGET_DOUBLE_FORMAT - these
+	 methods gdbarch_float_format and gdbarch_double_format - these
 	 exactly describe the target floating-point format.  The
 	 problem here is that the corresponding floatformat_vax_f and
 	 floatformat_vax_d values these methods should be set to are

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