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][29/37] Eliminate builtin_type_ macros: Update valarith.c routines


Hello,

this removes the last remaining instances of builtin_type_ in valarith.c.

value_x_unop can simply use a platform-neutral type for the constant 0
argument ot the UNOP_POSTINCREMENT/UNOP_POSTDECREMENT operator inferior
calls; call_function_by_hand will take care of promoting this to the
proper architecture-specific type when performing the call.

value_bit_index only wants to access one single target byte; there is
no need to use an architecture-specific type to do so.

Bye,
Ulrich

ChangeLog:

	* valarith.c (value_x_unop): Use builtin_type_int8 as type for
	UNOP_POSTINCREMENT/UNOP_POSTDECREMENT constant 0 argument.
	(value_bit_index): Use extract_unsigned_integer
	instead of unpack_long to read single byte.

Index: gdb-head/gdb/valarith.c
===================================================================
--- gdb-head.orig/gdb/valarith.c
+++ gdb-head/gdb/valarith.c
@@ -541,13 +541,13 @@ value_x_unop (struct value *arg1, enum e
       break;
     case UNOP_POSTINCREMENT:
       strcpy (ptr, "++");
-      argvec[2] = value_from_longest (builtin_type_int, 0);
+      argvec[2] = value_from_longest (builtin_type_int8, 0);
       argvec[3] = 0;
       nargs ++;
       break;
     case UNOP_POSTDECREMENT:
       strcpy (ptr, "--");
-      argvec[2] = value_from_longest (builtin_type_int, 0);
+      argvec[2] = value_from_longest (builtin_type_int8, 0);
       argvec[3] = 0;
       nargs ++;
       break;
@@ -1558,8 +1558,7 @@ value_bit_index (struct type *type, cons
   if (index < low_bound || index > high_bound)
     return -1;
   rel_index = index - low_bound;
-  word = unpack_long (builtin_type_unsigned_char,
-		      valaddr + (rel_index / TARGET_CHAR_BIT));
+  word = extract_unsigned_integer (valaddr + (rel_index / TARGET_CHAR_BIT), 1);
   rel_index %= TARGET_CHAR_BIT;
   if (gdbarch_bits_big_endian (current_gdbarch))
     rel_index = TARGET_CHAR_BIT - 1 - rel_index;

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