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


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

[rfc][24/37] Eliminate builtin_type_ macros: Platform-neutral generic integers


Hello,

a number of places use "builtin_type_int" when they need some generic
integer type, e.g. as range type for some internal array, or as fall-back
default if the real type is unknown.  This patch changes those places
to simply use builtin_type_int32 instead.

Bye,
Ulrich

ChangeLog:

	* ada-lang.c (ada_coerce_to_simple_array_type): Use builtin_type_int32
	instead of builtin_type_int as default unspecified integral type.
	(ada_index_type, ada_array_bound_from_type, ada_variant_discrim_type,
	assign_component, to_fixed_range_type): Likewise.
	* ada-typeprint.c (print_range, print_range_bound,
	print_range_type_named): Likewise.
	* ada-valprint.c (print_optional_low_bound, ada_val_print_1): Likewise.
	* eval.c (evaluate_subexp_standard): Likewise.
	* gnu-v2-abi.c (gnuv2_virtual_fn_field): Likewise.
	* gnu-v3-abi.c (gnuv3_get_virtual_fn, gnuv3_baseclass_offset,
	build_gdb_vtable_type): Likewise.
	* jv-lang.c (java_array_type): Likewise.
	* m2-typeprint.c (m2_print_bounds, m2_is_long_set_of_type): Likewise.
	* m2-valprint.c (m2_print_long_set): Likewise.
	* parse.c (follow_types): Likewise.
	* p-typeprint.c (pascal_type_print_base): Likewise.
	* valops.c (value_one, value_array, value_string,
	value_bitstring): Likewise.
	* value.c (allocate_repeat_value, value_from_string): Likewise.
	* varobj.c (c_describe_child): Likewise.
	* mt-tdep.c (mt_register_type): Likewise.
	* sh-tdep.c (sh_sh4_build_float_register_type): Likewise.
	* sh64-tdep.c (sh64_build_float_register_type): Likewise.


Index: gdb-head/gdb/ada-lang.c
===================================================================
--- gdb-head.orig/gdb/ada-lang.c
+++ gdb-head/gdb/ada-lang.c
@@ -1768,7 +1768,7 @@ struct type *
 ada_coerce_to_simple_array_type (struct type *type)
 {
   struct value *mark = value_mark ();
-  struct value *dummy = value_from_longest (builtin_type_long, 0);
+  struct value *dummy = value_from_longest (builtin_type_int32, 0);
   struct type *result;
   deprecated_set_value_type (dummy, type);
   result = ada_type_of_array (dummy, 0);
@@ -2509,7 +2509,7 @@ ada_index_type (struct type *type, int n
          has a target type of TYPE_CODE_UNDEF.  We compensate here, but
          perhaps stabsread.c would make more sense.  */
       if (result_type == NULL || TYPE_CODE (result_type) == TYPE_CODE_UNDEF)
-        result_type = builtin_type_int;
+        result_type = builtin_type_int32;
 
       return result_type;
     }
@@ -2537,7 +2537,7 @@ ada_array_bound_from_type (struct type *
   if (arr_type == NULL || !ada_is_simple_array_type (arr_type))
     {
       if (typep != NULL)
-        *typep = builtin_type_int;
+        *typep = builtin_type_int32;
       return (LONGEST) - which;
     }
 
@@ -5905,7 +5905,7 @@ ada_variant_discrim_type (struct type *v
   struct type *type =
     ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
   if (type == NULL)
-    return builtin_type_int;
+    return builtin_type_int32;
   else
     return type;
 }
@@ -8117,7 +8117,7 @@ assign_component (struct value *containe
   struct value *elt;
   if (TYPE_CODE (value_type (lhs)) == TYPE_CODE_ARRAY)
     {
-      struct value *index_val = value_from_longest (builtin_type_int, index);
+      struct value *index_val = value_from_longest (builtin_type_int32, index);
       elt = unwrap_value (ada_value_subscript (lhs, 1, &index_val));
     }
   else
@@ -9546,7 +9546,7 @@ to_fixed_range_type (char *name, struct 
   char *subtype_info;
 
   if (raw_type == NULL)
-    base_type = builtin_type_int;
+    base_type = builtin_type_int32;
   else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
     base_type = TYPE_TARGET_TYPE (raw_type);
   else
Index: gdb-head/gdb/ada-typeprint.c
===================================================================
--- gdb-head.orig/gdb/ada-typeprint.c
+++ gdb-head/gdb/ada-typeprint.c
@@ -149,7 +149,7 @@ print_range (struct type *type, struct u
     case TYPE_CODE_ENUM:
       break;
     default:
-      target_type = builtin_type_int;
+      target_type = builtin_type_int32;
       break;
     }
 
@@ -197,11 +197,11 @@ print_range_bound (struct type *type, ch
          the upper bound of the 0 .. -1 range types to be printed as
          a very large unsigned number instead of -1.
          To workaround this stabs deficiency, we replace the TYPE by
-         builtin_type_long when we detect that the bound is negative,
+         builtin_type_int32 when we detect that the bound is negative,
          and the type is a TYPE_CODE_INT.  The bound is negative when
          'm' is the last character of the number scanned in BOUNDS.  */
       if (bounds[*n - 1] == 'm' && TYPE_CODE (type) == TYPE_CODE_INT)
-	type = builtin_type_long;
+	type = builtin_type_int32;
       ada_print_scalar (type, B, stream);
       if (bounds[*n] == '_')
 	*n += 2;
@@ -258,7 +258,7 @@ print_range_type_named (char *name, stru
   char *subtype_info;
 
   if (raw_type == NULL)
-    base_type = builtin_type_int;
+    base_type = builtin_type_int32;
   else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
     base_type = TYPE_TARGET_TYPE (raw_type);
   else
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -122,7 +122,7 @@ print_optional_low_bound (struct ui_file
 	return 0;
       break;
     case TYPE_CODE_UNDEF:
-      index_type = builtin_type_long;
+      index_type = builtin_type_int32;
       /* FALL THROUGH */
     default:
       if (low_bound == 1)
@@ -753,7 +753,7 @@ ada_val_print_1 (struct type *type, cons
 		  make_pointer_type
 		  (create_array_type
 		   (NULL, builtin_type_true_char,
-		    create_range_type (NULL, builtin_type_int, 0, 32)), NULL);
+		    create_range_type (NULL, builtin_type_int32, 0, 32)), NULL);
 
 	      printable_val =
 		value_ind (value_cast (parray_of_char,
Index: gdb-head/gdb/eval.c
===================================================================
--- gdb-head.orig/gdb/eval.c
+++ gdb-head/gdb/eval.c
@@ -2028,7 +2028,7 @@ evaluate_subexp_standard (struct type *e
 
 	/* Construct a value node with the value of the offset */
 
-	arg2 = value_from_longest (builtin_type_f_integer, offset_item);
+	arg2 = value_from_longest (builtin_type_int32, offset_item);
 
 	/* Let us now play a dirty trick: we will take arg1 
 	   which is a value node pointing to the topmost level
Index: gdb-head/gdb/gnu-v3-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v3-abi.c
+++ gdb-head/gdb/gnu-v3-abi.c
@@ -132,7 +132,7 @@ build_gdb_vtable_type (struct gdbarch *a
   FIELD_NAME (*field) = "vcall_and_vbase_offsets";
   FIELD_TYPE (*field)
     = create_array_type (0, ptrdiff_type,
-                         create_range_type (0, builtin_type_int, 0, -1));
+                         create_range_type (0, builtin_type_int32, 0, -1));
   FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
@@ -155,7 +155,7 @@ build_gdb_vtable_type (struct gdbarch *a
   FIELD_NAME (*field) = "virtual_functions";
   FIELD_TYPE (*field)
     = create_array_type (0, ptr_to_void_fn_type,
-                         create_range_type (0, builtin_type_int, 0, -1));
+                         create_range_type (0, builtin_type_int32, 0, -1));
   FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
@@ -326,7 +326,7 @@ gnuv3_get_virtual_fn (struct value *cont
 
   /* Fetch the appropriate function pointer from the vtable.  */
   vfn = value_subscript (value_field (vtable, vtable_field_virtual_functions),
-                         value_from_longest (builtin_type_int, vtable_index));
+                         value_from_longest (builtin_type_int32, vtable_index));
 
   /* If this architecture uses function descriptors directly in the vtable,
      then the address of the vtable entry is actually a "function pointer"
@@ -429,7 +429,7 @@ gnuv3_baseclass_offset (struct type *typ
 						    address));
   vtable = value_at_lazy (vtable_type,
                           vtable_address - vtable_address_point_offset ());
-  offset_val = value_from_longest(builtin_type_int, cur_base_offset);
+  offset_val = value_from_longest(builtin_type_int32, cur_base_offset);
   vbase_array = value_field (vtable, vtable_field_vcall_and_vbase_offsets);
   base_offset = value_as_long (value_subscript (vbase_array, offset_val));
   return base_offset;
Index: gdb-head/gdb/jv-lang.c
===================================================================
--- gdb-head.orig/gdb/jv-lang.c
+++ gdb-head/gdb/jv-lang.c
@@ -775,7 +775,7 @@ java_array_type (struct type *type, int 
 
   while (dims-- > 0)
     {
-      range_type = create_range_type (NULL, builtin_type_int, 0, 0);
+      range_type = create_range_type (NULL, builtin_type_int32, 0, 0);
       /* FIXME  This is bogus!  Java arrays are not gdb arrays! */
       type = create_array_type (NULL, type, range_type);
     }
Index: gdb-head/gdb/m2-typeprint.c
===================================================================
--- gdb-head.orig/gdb/m2-typeprint.c
+++ gdb-head/gdb/m2-typeprint.c
@@ -287,7 +287,7 @@ m2_print_bounds (struct type *type,
   struct type *target = TYPE_TARGET_TYPE (type);
 
   if (target == NULL)
-    target = builtin_type_int;
+    target = builtin_type_int32;
 
   if (TYPE_NFIELDS(type) == 0)
     return;
@@ -394,7 +394,7 @@ m2_is_long_set_of_type (struct type *typ
       range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i));
       target = TYPE_TARGET_TYPE (range);
       if (target == NULL)
-	target = builtin_type_int;
+	target = builtin_type_int32;
 
       l1 = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)));
       h1 = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1)));
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -119,7 +119,7 @@ m2_print_long_set (struct type *type, co
 
   target = TYPE_TARGET_TYPE (range);
   if (target == NULL)
-    target = builtin_type_int;
+    target = builtin_type_int32;
 
   if (get_discrete_bounds (range, &field_low, &field_high) >= 0)
     {
@@ -165,7 +165,7 @@ m2_print_long_set (struct type *type, co
 		break;
 	      target = TYPE_TARGET_TYPE (range);
 	      if (target == NULL)
-		target = builtin_type_int;
+		target = builtin_type_int32;
 	    }
 	}
       if (element_seen)
Index: gdb-head/gdb/mt-tdep.c
===================================================================
--- gdb-head.orig/gdb/mt-tdep.c
+++ gdb-head/gdb/mt-tdep.c
@@ -258,7 +258,7 @@ mt_register_type (struct gdbarch *arch, 
       if (copro_type == NULL)
 	{
 	  struct type *temp;
-	  temp = create_range_type (NULL, builtin_type_unsigned_int, 0, 1);
+	  temp = create_range_type (NULL, builtin_type_int32, 0, 1);
 	  copro_type = create_array_type (NULL, builtin_type_int16, temp);
 	}
       switch (regnum)
Index: gdb-head/gdb/parse.c
===================================================================
--- gdb-head.orig/gdb/parse.c
+++ gdb-head/gdb/parse.c
@@ -1262,7 +1262,7 @@ follow_types (struct type *follow_type)
 	   done with it.  */
 	range_type =
 	  create_range_type ((struct type *) NULL,
-			     builtin_type_int, 0,
+			     builtin_type_int32, 0,
 			     array_size >= 0 ? array_size - 1 : 0);
 	follow_type =
 	  create_array_type ((struct type *) NULL,
Index: gdb-head/gdb/p-typeprint.c
===================================================================
--- gdb-head.orig/gdb/p-typeprint.c
+++ gdb-head/gdb/p-typeprint.c
@@ -756,7 +756,7 @@ pascal_type_print_base (struct type *typ
       {
 	struct type *target = TYPE_TARGET_TYPE (type);
 	if (target == NULL)
-	  target = builtin_type_long;
+	  target = builtin_type_int32;
 	print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
 	fputs_filtered ("..", stream);
 	print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
Index: gdb-head/gdb/sh64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh64-tdep.c
+++ gdb-head/gdb/sh64-tdep.c
@@ -1507,7 +1507,7 @@ sh64_build_float_register_type (int high
 {
   struct type *temp;
 
-  temp = create_range_type (NULL, builtin_type_int, 0, high);
+  temp = create_range_type (NULL, builtin_type_int32, 0, high);
   return create_array_type (NULL, builtin_type_float, temp);
 }
 
Index: gdb-head/gdb/sh-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh-tdep.c
+++ gdb-head/gdb/sh-tdep.c
@@ -2156,7 +2156,7 @@ sh_sh4_build_float_register_type (int hi
 {
   struct type *temp;
 
-  temp = create_range_type (NULL, builtin_type_int, 0, high);
+  temp = create_range_type (NULL, builtin_type_int32, 0, high);
   return create_array_type (NULL, builtin_type_float, temp);
 }
 
Index: gdb-head/gdb/valops.c
===================================================================
--- gdb-head.orig/gdb/valops.c
+++ gdb-head/gdb/valops.c
@@ -522,11 +522,11 @@ value_one (struct type *type, enum lval_
 
   if (TYPE_CODE (type1) == TYPE_CODE_DECFLOAT)
     {
-      struct value *int_one = value_from_longest (builtin_type_int, 1);
+      struct value *int_one = value_from_longest (builtin_type_int32, 1);
       struct value *val;
       gdb_byte v[16];
 
-      decimal_from_integral (int_one, v, TYPE_LENGTH (builtin_type_int));
+      decimal_from_integral (int_one, v, TYPE_LENGTH (builtin_type_int32));
       val = value_from_decfloat (type, v);
     }
   else if (TYPE_CODE (type1) == TYPE_CODE_FLT)
@@ -1241,7 +1241,7 @@ value_array (int lowbound, int highbound
     }
 
   rangetype = create_range_type ((struct type *) NULL, 
-				 builtin_type_int,
+				 builtin_type_int32,
 				 lowbound, highbound);
   arraytype = create_array_type ((struct type *) NULL,
 				 value_enclosing_type (elemvec[0]), 
@@ -1285,7 +1285,7 @@ value_string (char *ptr, int len)
   struct value *val;
   int lowbound = current_language->string_lower_bound;
   struct type *rangetype = create_range_type ((struct type *) NULL,
-					      builtin_type_int,
+					      builtin_type_int32,
 					      lowbound, 
 					      len + lowbound - 1);
   struct type *stringtype
@@ -1315,7 +1315,7 @@ value_bitstring (char *ptr, int len)
 {
   struct value *val;
   struct type *domain_type = create_range_type (NULL, 
-						builtin_type_int,
+						builtin_type_int32,
 						0, len - 1);
   struct type *type = create_set_type ((struct type *) NULL, 
 				       domain_type);
Index: gdb-head/gdb/value.c
===================================================================
--- gdb-head.orig/gdb/value.c
+++ gdb-head/gdb/value.c
@@ -249,7 +249,7 @@ allocate_repeat_value (struct type *type
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
   struct type *range_type
-  = create_range_type ((struct type *) NULL, builtin_type_int,
+  = create_range_type ((struct type *) NULL, builtin_type_int32,
 		       low_bound, count + low_bound - 1);
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
@@ -1638,7 +1638,7 @@ value_from_string (char *ptr)
   struct type *stringtype;
 
   rangetype = create_range_type ((struct type *) NULL,
-				 builtin_type_int,
+				 builtin_type_int32,
 				 lowbound, len + lowbound - 1);
   string_char_type = language_string_char_type (current_language,
 						current_gdbarch);
Index: gdb-head/gdb/varobj.c
===================================================================
--- gdb-head.orig/gdb/varobj.c
+++ gdb-head/gdb/varobj.c
@@ -2072,7 +2072,7 @@ c_describe_child (struct varobj *parent,
 	{
 	  int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
 	  struct value *indval = 
-	    value_from_longest (builtin_type_int, (LONGEST) real_index);
+	    value_from_longest (builtin_type_int32, (LONGEST) real_index);
 	  gdb_value_subscript (value, indval, cvalue);
 	}
 
Index: gdb-head/gdb/gnu-v2-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v2-abi.c
+++ gdb-head/gdb/gnu-v2-abi.c
@@ -97,7 +97,7 @@ gnuv2_virtual_fn_field (struct value **a
   struct value *entry;
   struct value *vfn;
   struct value *vtbl;
-  struct value *vi = value_from_longest (builtin_type_int,
+  struct value *vi = value_from_longest (builtin_type_int32,
 				     (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
   struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j);
   struct type *context;

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


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