Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
@ 2007-06-08 10:26 Markus Deuling
  2007-06-12 14:17 ` Ulrich Weigand
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Deuling @ 2007-06-08 10:26 UTC (permalink / raw)
  To: GDB Patches; +Cc: Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 2862 bytes --]

Hello,

this patch removes following macros from gdbarch.sh: 


* TARGET_FLOAT_BIT
* TARGET_FLOAT_FORMAT
* TARGET_DOUBLE_BIT
* TARGET_DOUBLE_FORMAT
* TARGET_LONG_DOUBLE_BIT
* TARGET_LONG_DOUBLE_FORMAT 


ChangeLog:

	* gdbarch.sh (TARGET_FLOAT_BIT): Replace by gdbarch_float_bit.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* mdebugread.c (_initialize_mdebugread): Likewise.
	* m2-lang.c (m2_create_fundamental_type)
	(_initialize_m2_language): Likewise.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbarch.sh (TARGET_FLOAT_FORMAT): Replace by gdbarch_float_format.
	* value.c (unpack_double): Likewise (comment).
	* gdbtypes.c (build_gdbtypes): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* gdbarch.sh (TARGET_DOUBLE_BIT): Replace by gdbarch_double_bit.
	* valarith.c (value_binop): Likewise.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* mdebugread.c (_initialize_mdebugread): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* cris-tdep.c (cris_gdbarch_init): Likewise (comment).
	* c-lang.c (c_create_fundamental_type): Likewise.
	* ada-lex.l (processReal): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbarch.sh (TARGET_DOUBLE_FORMAT): Replace by gdbarch_double_format.
	* value.c (unpack_double): Likewise (comment).
	* gdbtypes.c (build_gdbtypes): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* gdbarch.sh (TARGET_LONG_DOUBLE_BIT): Replace by
	gdbarch_long_double_bit.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* ada-lex.l (processReal): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbarch.sh (TARGET_LONG_DOUBLE_FORMAT): Replace by
	gdbarch_long_double_format.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* gdbarch.c, gdbarch.h: Regenerate.




Is this ok to commit? 

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











[-- Attachment #2: diff-remove-FLOAT --]
[-- Type: text/plain, Size: 29749 bytes --]

diff -urN src.orig/gdb/ada-lang.c src.1/gdb/ada-lang.c
--- src.orig/gdb/ada-lang.c	2007-06-08 09:20:29.000000000 +0200
+++ src.1/gdb/ada-lang.c	2007-06-08 09:40:49.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,18 +10346,21 @@
     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,
-               0, "long_float", (struct objfile *) NULL);
+    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,
-               0, "long_long_float", (struct objfile *) NULL);
+    init_type (TYPE_CODE_FLT,
+	       gdbarch_long_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,
 	       gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
diff -urN src.orig/gdb/ada-lex.l src.1/gdb/ada-lex.l
--- src.orig/gdb/ada-lex.l	2007-06-08 09:20:29.000000000 +0200
+++ src.1/gdb/ada-lex.l	2007-06-08 09:43:09.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.orig/gdb/c-lang.c src.1/gdb/c-lang.c
--- src.orig/gdb/c-lang.c	2007-06-08 09:20:29.000000000 +0200
+++ src.1/gdb/c-lang.c	2007-06-08 09:41:51.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.orig/gdb/cris-tdep.c src.1/gdb/cris-tdep.c
--- src.orig/gdb/cris-tdep.c	2007-05-31 19:31:37.000000000 +0200
+++ src.1/gdb/cris-tdep.c	2007-06-08 09:21:16.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.orig/gdb/doublest.c src.1/gdb/doublest.c
--- src.orig/gdb/doublest.c	2007-05-31 19:11:18.000000000 +0200
+++ src.1/gdb/doublest.c	2007-06-08 09:31:16.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.orig/gdb/f-lang.c src.1/gdb/f-lang.c
--- src.orig/gdb/f-lang.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/f-lang.c	2007-06-08 09:37:37.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.orig/gdb/gdbarch.c src.1/gdb/gdbarch.c
--- src.orig/gdb/gdbarch.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/gdbarch.c	2007-06-08 09:21:16.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 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
@@ -873,19 +873,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));
@@ -952,19 +942,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));
@@ -1030,19 +1010,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.orig/gdb/gdbarch.h src.1/gdb/gdbarch.h
--- src.orig/gdb/gdbarch.h	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/gdbarch.h	2007-06-08 09:21:16.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.orig/gdb/gdbarch.sh src.1/gdb/gdbarch.sh
--- src.orig/gdb/gdbarch.sh	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/gdbarch.sh	2007-06-08 09:21:16.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.orig/gdb/gdbtypes.c src.1/gdb/gdbtypes.c
--- src.orig/gdb/gdbtypes.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/gdbtypes.c	2007-06-08 09:27:24.000000000 +0200
@@ -3466,22 +3466,26 @@
 	       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,
-	       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 (builtin_type_complex) = builtin_type_float;
   builtin_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 (builtin_type_double_complex) = builtin_type_double;
   builtin_type_string =
     init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
diff -urN src.orig/gdb/m2-lang.c src.1/gdb/m2-lang.c
--- src.orig/gdb/m2-lang.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/m2-lang.c	2007-06-08 09:38:22.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.orig/gdb/mdebugread.c src.1/gdb/mdebugread.c
--- src.orig/gdb/mdebugread.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/mdebugread.c	2007-06-08 09:39:09.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.orig/gdb/objc-lang.c src.1/gdb/objc-lang.c
--- src.orig/gdb/objc-lang.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/objc-lang.c	2007-06-08 09:39:37.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.orig/gdb/p-lang.c src.1/gdb/p-lang.c
--- src.orig/gdb/p-lang.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/p-lang.c	2007-06-08 09:40:12.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.orig/gdb/valarith.c src.1/gdb/valarith.c
--- src.orig/gdb/valarith.c	2007-06-08 09:20:30.000000000 +0200
+++ src.1/gdb/valarith.c	2007-06-08 09:21:16.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.orig/gdb/value.c src.1/gdb/value.c
--- src.orig/gdb/value.c	2007-05-31 19:11:18.000000000 +0200
+++ src.1/gdb/value.c	2007-06-08 09:21:16.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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
  2007-06-08 10:26 [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT} Markus Deuling
@ 2007-06-12 14:17 ` Ulrich Weigand
  2007-06-12 14:47   ` Markus Deuling
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Weigand @ 2007-06-12 14:17 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

Markus Deuling wrote:

> this patch removes following macros from gdbarch.sh: 
> 
> * TARGET_FLOAT_BIT
> * TARGET_FLOAT_FORMAT
> * TARGET_DOUBLE_BIT
> * TARGET_DOUBLE_FORMAT
> * TARGET_LONG_DOUBLE_BIT
> * TARGET_LONG_DOUBLE_FORMAT 


   /* 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

Well, replacing the macro by a gdbarch function invalidates the whole point
the comment is making ;-)  You should either use another macro (that still
is a macro) as example, or -once there are no macros left- remove that
comment.


+  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));
It might be nicer to move the built_flt to its own line
   builtin_type_long_double
     = build_fld (gdbarch_long_double_bit (current_gdbarch),
              ... 

Otherwise this is OK, thanks!

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
  2007-06-12 14:17 ` Ulrich Weigand
@ 2007-06-12 14:47   ` Markus Deuling
  2007-06-12 15:39     ` Ulrich Weigand
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Deuling @ 2007-06-12 14:47 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

Hallo Ulrich,

thank you for your review again.

Ulrich Weigand wrote:
> 
> 
>    /* 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
> 
> Well, replacing the macro by a gdbarch function invalidates the whole point
> the comment is making ;-)  You should either use another macro (that still
> is a macro) as example, or -once there are no macros left- remove that
> comment.
> 
>
You're right :-) I took TARGET_ARCHITECTURE for now. I'll remove the comment when finishing the macro transition.

Attached is a reworked patch.


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


[-- Attachment #2: diff-remove-FLOAT --]
[-- Type: text/plain, Size: 29072 bytes --]

diff -urN src/gdb/ada-lang.c dev/gdb/ada-lang.c
--- src/gdb/ada-lang.c	2007-06-08 05:38:50.000000000 +0200
+++ dev/gdb/ada-lang.c	2007-06-12 16:41:56.000000000 +0200
@@ -10284,17 +10284,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;
     }
@@ -10339,16 +10340,19 @@
     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, TARGET_LONG_LONG_BIT / 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_long_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, TARGET_INT_BIT / TARGET_CHAR_BIT,
diff -urN src/gdb/ada-lex.l dev/gdb/ada-lex.l
--- src/gdb/ada-lex.l	2007-01-09 18:58:49.000000000 +0100
+++ dev/gdb/ada-lex.l	2007-06-12 16:32:39.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-05-07 13:49:04.000000000 +0200
+++ dev/gdb/c-lang.c	2007-06-12 16:32:39.000000000 +0200
@@ -310,41 +310,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 16:32:39.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 16:32:39.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-01-09 18:58:50.000000000 +0100
+++ dev/gdb/f-lang.c	2007-06-12 16:32:39.000000000 +0200
@@ -350,39 +350,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;
@@ -528,28 +531,33 @@
 	       "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;
@@ -558,7 +566,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-11 11:31:56.000000000 +0200
+++ dev/gdb/gdbarch.c	2007-06-12 16:43:09.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));
@@ -999,19 +979,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-11 11:31:56.000000000 +0200
+++ dev/gdb/gdbarch.h	2007-06-12 16:32:39.000000000 +0200
@@ -136,57 +136,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-11 11:31:56.000000000 +0200
+++ dev/gdb/gdbarch.sh	2007-06-12 16:32:39.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-08 05:38:50.000000000 +0200
+++ dev/gdb/gdbtypes.c	2007-06-12 16:40:07.000000000 +0200
@@ -3466,20 +3466,26 @@
 	       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-01-09 18:58:51.000000000 +0100
+++ dev/gdb/m2-lang.c	2007-06-12 16:32:39.000000000 +0200
@@ -307,41 +307,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);
@@ -456,7 +460,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-01-09 18:58:52.000000000 +0100
+++ dev/gdb/mdebugread.c	2007-06-12 16:32:39.000000000 +0200
@@ -4840,22 +4840,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?
@@ -4877,7 +4877,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-11 11:31:58.000000000 +0200
+++ dev/gdb/objc-lang.c	2007-06-12 16:32:40.000000000 +0200
@@ -547,17 +547,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-01-09 18:58:55.000000000 +0100
+++ dev/gdb/p-lang.c	2007-06-12 16:32:40.000000000 +0200
@@ -373,17 +373,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-01-09 18:58:59.000000000 +0100
+++ dev/gdb/valarith.c	2007-06-12 16:32:40.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 16:32:40.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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
  2007-06-12 14:47   ` Markus Deuling
@ 2007-06-12 15:39     ` Ulrich Weigand
  2007-06-12 16:15       ` Markus Deuling
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Weigand @ 2007-06-12 15:39 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

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?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
  2007-06-12 15:39     ` Ulrich Weigand
@ 2007-06-12 16:15       ` Markus Deuling
  2007-06-12 16:37         ` Ulrich Weigand
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Deuling @ 2007-06-12 16:15 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

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


[-- Attachment #2: diff-remove-FLOAT --]
[-- Type: text/plain, Size: 29150 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
  2007-06-12 16:15       ` Markus Deuling
@ 2007-06-12 16:37         ` Ulrich Weigand
  2007-06-12 16:39           ` Markus Deuling
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Weigand @ 2007-06-12 16:37 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

Markus Deuling wrote:

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

Thanks.  One more thing: I've found an inconsistency in the gdbarch.c /
gdbarch.sh changes:

> 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

> 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
> @@ -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

I've now committed the patch with this fixed.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT}
  2007-06-12 16:37         ` Ulrich Weigand
@ 2007-06-12 16:39           ` Markus Deuling
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Deuling @ 2007-06-12 16:39 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

Ulrich Weigand wrote:
> Markus Deuling wrote:
> 
>> Sorry. Attached is a rebased version that applies against current head :-)
> 
> Thanks.  One more thing: I've found an inconsistency in the gdbarch.c /
> gdbarch.sh changes:
> 
>> 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
> 
>> 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
>> @@ -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
> 
> I've now committed the patch with this fixed.
> 
> Bye,
> Ulrich
> 

Again, thank you very much :-)


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-06-12 16:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-08 10:26 [rfc] [2/2] Remove macros TARGET_{FLOAT,DOUBLE,LONG_DOUBLE}_{BIT|FORMAT} Markus Deuling
2007-06-12 14:17 ` Ulrich Weigand
2007-06-12 14:47   ` Markus Deuling
2007-06-12 15:39     ` Ulrich Weigand
2007-06-12 16:15       ` Markus Deuling
2007-06-12 16:37         ` Ulrich Weigand
2007-06-12 16:39           ` Markus Deuling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox