From c6d940a9569deb4a89a5628caa78b1ccfcfd2bdf Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 14 Sep 2020 11:07:57 -0400 Subject: gdb: remove TYPE_UNSIGNED gdb/ChangeLog: * gdbtypes.h (TYPE_UNSIGNED): Remove, replace all uses with type::is_unsigned. Change-Id: I84f76f5cd44ff7294e421d317376a9e476bc8666 --- gdb/ChangeLog | 5 +++++ gdb/aarch64-tdep.c | 2 +- gdb/ada-lang.c | 10 +++++----- gdb/ada-valprint.c | 4 ++-- gdb/ax-gdb.c | 17 ++++++++--------- gdb/compile/compile-c-support.c | 2 +- gdb/compile/compile-c-types.c | 6 +++--- gdb/compile/compile-cplus-types.c | 4 ++-- gdb/dwarf2/expr.c | 6 +++--- gdb/dwarf2/loc.c | 2 +- gdb/dwarf2/read.c | 10 +++++----- gdb/eval.c | 4 ++-- gdb/f-exp.y | 2 +- gdb/gdbtypes.c | 22 +++++++++++----------- gdb/gdbtypes.h | 8 +++----- gdb/guile/scm-math.c | 4 ++-- gdb/guile/scm-value.c | 4 ++-- gdb/m2-typeprint.c | 2 +- gdb/mips-tdep.c | 2 +- gdb/opencl-lang.c | 8 ++++---- gdb/printcmd.c | 6 +++--- gdb/python/py-value.c | 4 ++-- gdb/rust-lang.c | 6 +++--- gdb/s390-tdep.c | 4 ++-- gdb/stabsread.c | 6 +++--- gdb/typeprint.c | 2 +- gdb/valarith.c | 12 ++++++------ gdb/valops.c | 4 ++-- gdb/valprint.c | 2 +- gdb/value.c | 4 ++-- 30 files changed, 88 insertions(+), 86 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a10bef5..4772433 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-09-14 Simon Marchi + * gdbtypes.h (TYPE_UNSIGNED): Remove, replace all uses with + type::is_unsigned. + +2020-09-14 Simon Marchi + * gdbtypes.h (struct type) : New methods. (TYPE_UNSIGNED): Use type::is_unsigned. Change all write call diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 106939a..61e8e57 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1885,7 +1885,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (len < 4) { /* Promote to 32 bit integer. */ - if (TYPE_UNSIGNED (arg_type)) + if (arg_type->is_unsigned ()) arg_type = builtin_type (gdbarch)->builtin_uint32; else arg_type = builtin_type (gdbarch)->builtin_int32; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index f13866e..c014d1c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -701,7 +701,7 @@ umax_of_size (int size) static LONGEST max_of_type (struct type *t) { - if (TYPE_UNSIGNED (t)) + if (t->is_unsigned ()) return (LONGEST) umax_of_size (TYPE_LENGTH (t)); else return max_of_size (TYPE_LENGTH (t)); @@ -711,7 +711,7 @@ max_of_type (struct type *t) static LONGEST min_of_type (struct type *t) { - if (TYPE_UNSIGNED (t)) + if (t->is_unsigned ()) return 0; else return min_of_size (TYPE_LENGTH (t)); @@ -2276,7 +2276,7 @@ has_negatives (struct type *type) default: return 0; case TYPE_CODE_INT: - return !TYPE_UNSIGNED (type); + return !type->is_unsigned (); case TYPE_CODE_RANGE: return type->bounds ()->low.const_val () - type->bounds ()->bias < 0; } @@ -9354,7 +9354,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) if (v2 == 0) error (_("second operand of %s must not be zero."), op_string (op)); - if (TYPE_UNSIGNED (type1) || op == BINOP_MOD) + if (type1->is_unsigned () || op == BINOP_MOD) return value_binop (arg1, arg2, op); v1 = value_as_long (arg1); @@ -11444,7 +11444,7 @@ ada_is_modular_type (struct type *type) return (subranged_type != NULL && type->code () == TYPE_CODE_RANGE && subranged_type->code () == TYPE_CODE_INT - && TYPE_UNSIGNED (subranged_type)); + && subranged_type->is_unsigned ()); } /* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */ diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index c61688d..3616711 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -398,7 +398,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream) break; case TYPE_CODE_INT: - print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, val); + print_longest (stream, type->is_unsigned () ? 'u' : 'd', 0, val); break; case TYPE_CODE_CHAR: @@ -1129,7 +1129,7 @@ ada_value_print (struct value *val0, struct ui_file *stream, type is indicated by the quoted string anyway. */ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char) || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT - || TYPE_UNSIGNED (TYPE_TARGET_TYPE (type))) + || TYPE_TARGET_TYPE (type)->is_unsigned ()) { fprintf_filtered (stream, "("); type_print (type, "", stream, -1); diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 34e22b2..78272f7 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -444,7 +444,7 @@ static void gen_sign_extend (struct agent_expr *ax, struct type *type) { /* Do we need to sign-extend this? */ - if (!TYPE_UNSIGNED (type)) + if (!type->is_unsigned ()) ax_ext (ax, TYPE_LENGTH (type) * TARGET_CHAR_BIT); } @@ -458,7 +458,7 @@ gen_extend (struct agent_expr *ax, struct type *type) int bits = TYPE_LENGTH (type) * TARGET_CHAR_BIT; /* I just had to. */ - ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, bits)); + ((type->is_unsigned () ? ax_zero_ext : ax_ext) (ax, bits)); } @@ -871,8 +871,8 @@ type_wider_than (struct type *type1, struct type *type2) { return (TYPE_LENGTH (type1) > TYPE_LENGTH (type2) || (TYPE_LENGTH (type1) == TYPE_LENGTH (type2) - && TYPE_UNSIGNED (type1) - && !TYPE_UNSIGNED (type2))); + && type1->is_unsigned () + && !type2->is_unsigned ())); } @@ -899,7 +899,7 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to) then we need to extend. */ else if (TYPE_LENGTH (to) == TYPE_LENGTH (from)) { - if (TYPE_UNSIGNED (from) != TYPE_UNSIGNED (to)) + if (from->is_unsigned () != to->is_unsigned ()) gen_extend (ax, to); } @@ -907,7 +907,7 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to) we need to zero out any possible sign bits. */ else if (TYPE_LENGTH (to) > TYPE_LENGTH (from)) { - if (TYPE_UNSIGNED (to)) + if (to->is_unsigned ()) gen_extend (ax, to); } } @@ -1162,8 +1162,7 @@ gen_binop (struct agent_expr *ax, struct axs_value *value, || (value2->type->code () != TYPE_CODE_INT)) error (_("Invalid combination of types in %s."), name); - ax_simple (ax, - TYPE_UNSIGNED (value1->type) ? op_unsigned : op); + ax_simple (ax, value1->type->is_unsigned () ? op_unsigned : op); if (may_carry) gen_extend (ax, value1->type); /* catch overflow */ value->type = value1->type; @@ -1399,7 +1398,7 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value, ax_simple (ax, aop_bit_or); /* Sign- or zero-extend the value as appropriate. */ - ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, end - start)); + ((type->is_unsigned () ? ax_zero_ext : ax_ext) (ax, end - start)); /* This is *not* an lvalue. Ugh. */ value->kind = axs_rvalue; diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c index 5e4da67..636ac84 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -256,7 +256,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, if (mode != NULL) { - if (TYPE_UNSIGNED (regtype)) + if (regtype->is_unsigned ()) fputs_unfiltered ("unsigned ", stream); fprintf_unfiltered (stream, "int %s" diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 2b25783..a34550a 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -130,7 +130,7 @@ convert_enum (compile_c_instance *context, struct type *type) gcc_type int_type, result; int i; - int_type = context->plugin ().int_type_v0 (TYPE_UNSIGNED (type), + int_type = context->plugin ().int_type_v0 (type->is_unsigned (), TYPE_LENGTH (type)); result = context->plugin ().build_enum_type (int_type); @@ -199,12 +199,12 @@ convert_int (compile_c_instance *context, struct type *type) gdb_assert (TYPE_LENGTH (type) == 1); return context->plugin ().char_type (); } - return context->plugin ().int_type (TYPE_UNSIGNED (type), + return context->plugin ().int_type (type->is_unsigned (), TYPE_LENGTH (type), type->name ()); } else - return context->plugin ().int_type_v0 (TYPE_UNSIGNED (type), + return context->plugin ().int_type_v0 (type->is_unsigned (), TYPE_LENGTH (type)); } diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 02df7ab..647cfc5 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -929,7 +929,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type, instance->enter_scope (std::move (scope)); gcc_type int_type - = instance->plugin ().get_int_type (TYPE_UNSIGNED (type), + = instance->plugin ().get_int_type (type->is_unsigned (), TYPE_LENGTH (type), nullptr); gcc_type result = instance->plugin ().start_enum_type (name.get (), int_type, @@ -1022,7 +1022,7 @@ compile_cplus_convert_int (compile_cplus_instance *instance, struct type *type) } return instance->plugin ().get_int_type - (TYPE_UNSIGNED (type), TYPE_LENGTH (type), type->name ()); + (type->is_unsigned (), TYPE_LENGTH (type), type->name ()); } /* Convert a floating-point type to its gcc representation. */ diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 9bf7413..ab511d5 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -366,7 +366,7 @@ base_types_equal_p (struct type *t1, struct type *t2) { if (t1->code () != t2->code ()) return 0; - if (TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2)) + if (t1->is_unsigned () != t2->is_unsigned ()) return 0; return TYPE_LENGTH (t1) == TYPE_LENGTH (t2); } @@ -1087,7 +1087,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, case DW_OP_shr: dwarf_require_integral (value_type (first)); dwarf_require_integral (value_type (second)); - if (!TYPE_UNSIGNED (value_type (first))) + if (!value_type (first)->is_unsigned ()) { struct type *utype = get_unsigned_type (this->gdbarch, value_type (first)); @@ -1104,7 +1104,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, case DW_OP_shra: dwarf_require_integral (value_type (first)); dwarf_require_integral (value_type (second)); - if (TYPE_UNSIGNED (value_type (first))) + if (value_type (first)->is_unsigned ()) { struct type *stype = get_signed_type (this->gdbarch, value_type (first)); diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index a2bed9d..c18ac70 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -2603,7 +2603,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, struct type *type = check_typedef (baton->property_type); if (TYPE_LENGTH (type) < sizeof (CORE_ADDR) - && !TYPE_UNSIGNED (type)) + && !type->is_unsigned ()) { /* If we have a valid return candidate and it's value is signed, we have to sign-extend the value because diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1219bb9..b461bd1 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9499,7 +9499,7 @@ alloc_rust_variant (struct obstack *obstack, struct type *type, part->is_unsigned = (discriminant_index == -1 ? false - : TYPE_UNSIGNED (type->field (discriminant_index).type ())); + : type->field (discriminant_index).type ()->is_unsigned ()); part->variants = gdb::array_view (variants, n_variants); void *storage = obstack_alloc (obstack, sizeof (gdb::array_view)); @@ -15358,7 +15358,7 @@ create_one_variant_part (variant_part &result, { result.discriminant_index = iter->second; result.is_unsigned - = TYPE_UNSIGNED (fi->fields[result.discriminant_index].field.type ()); + = fi->fields[result.discriminant_index].field.type ()->is_unsigned (); } size_t n = builder.variants.size (); @@ -18355,10 +18355,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) negative_mask = -((ULONGEST) 1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1)); if (low.kind () == PROP_CONST - && !TYPE_UNSIGNED (base_type) && (low.const_val () & negative_mask)) + && !base_type->is_unsigned () && (low.const_val () & negative_mask)) low.set_const_val (low.const_val () | negative_mask); if (high.kind () == PROP_CONST - && !TYPE_UNSIGNED (base_type) && (high.const_val () & negative_mask)) + && !base_type->is_unsigned () && (high.const_val () & negative_mask)) high.set_const_val (high.const_val () | negative_mask); /* Check for bit and byte strides. */ @@ -24087,7 +24087,7 @@ dwarf2_cu::addr_type () const if (TYPE_LENGTH (addr_type) == addr_size) return addr_type; - addr_type = addr_sized_int_type (TYPE_UNSIGNED (addr_type)); + addr_type = addr_sized_int_type (addr_type->is_unsigned ()); return addr_type; } diff --git a/gdb/eval.c b/gdb/eval.c index 51b5186..3587dfe 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -500,8 +500,8 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, const struct builtin_type *builtin = builtin_type (gdbarch); unsigned int promoted_len1 = TYPE_LENGTH (type1); unsigned int promoted_len2 = TYPE_LENGTH (type2); - int is_unsigned1 = TYPE_UNSIGNED (type1); - int is_unsigned2 = TYPE_UNSIGNED (type2); + int is_unsigned1 = type1->is_unsigned (); + int is_unsigned2 = type2->is_unsigned (); unsigned int result_len; int unsigned_operation; diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 0fa18dd..0ccb3c6 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -827,7 +827,7 @@ push_kind_type (LONGEST val, struct type *type) { int ival; - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) { ULONGEST uval = static_cast (val); if (uval > INT_MAX) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 89a310f..5649937 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1088,7 +1088,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) case TYPE_CODE_INT: if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */ return -1; - if (!TYPE_UNSIGNED (type)) + if (!type->is_unsigned ()) { *lowp = -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1)); *highp = -*lowp - 1; @@ -1811,7 +1811,7 @@ get_unsigned_type_max (struct type *type, ULONGEST *max) unsigned int n; type = check_typedef (type); - gdb_assert (type->code () == TYPE_CODE_INT && TYPE_UNSIGNED (type)); + gdb_assert (type->code () == TYPE_CODE_INT && type->is_unsigned ()); gdb_assert (TYPE_LENGTH (type) <= sizeof (ULONGEST)); /* Written this way to avoid overflow. */ @@ -1828,7 +1828,7 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max) unsigned int n; type = check_typedef (type); - gdb_assert (type->code () == TYPE_CODE_INT && !TYPE_UNSIGNED (type)); + gdb_assert (type->code () == TYPE_CODE_INT && !type->is_unsigned ()); gdb_assert (TYPE_LENGTH (type) <= sizeof (LONGEST)); n = TYPE_LENGTH (type) * TARGET_CHAR_BIT; @@ -3989,7 +3989,7 @@ check_types_equal (struct type *type1, struct type *type2, if (type1->code () != type2->code () || TYPE_LENGTH (type1) != TYPE_LENGTH (type2) - || TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2) + || type1->is_unsigned () != type2->is_unsigned () || TYPE_NOSIGN (type1) != TYPE_NOSIGN (type2) || TYPE_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2) || TYPE_VARARGS (type1) != TYPE_VARARGS (type2) @@ -4272,9 +4272,9 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value else /* signed/unsigned char -> plain char */ return INTEGER_CONVERSION_BADNESS; } - else if (TYPE_UNSIGNED (parm)) + else if (parm->is_unsigned ()) { - if (TYPE_UNSIGNED (arg)) + if (arg->is_unsigned ()) { /* unsigned int -> unsigned int, or unsigned long -> unsigned long */ @@ -4304,7 +4304,7 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value return INTEGER_CONVERSION_BADNESS; } } - else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg)) + else if (!TYPE_NOSIGN (arg) && !arg->is_unsigned ()) { if (integer_types_same_name_p (parm->name (), arg->name ())) @@ -4394,14 +4394,14 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu else return INTEGER_CONVERSION_BADNESS; } - else if (TYPE_UNSIGNED (parm)) + else if (parm->is_unsigned ()) { - if (TYPE_UNSIGNED (arg)) + if (arg->is_unsigned ()) return EXACT_MATCH_BADNESS; else return INTEGER_PROMOTION_BADNESS; } - else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg)) + else if (!TYPE_NOSIGN (arg) && !arg->is_unsigned ()) return EXACT_MATCH_BADNESS; else return INTEGER_CONVERSION_BADNESS; @@ -5064,7 +5064,7 @@ recursive_dump_type (struct type *type, int spaces) puts_filtered ("\n"); printfi_filtered (spaces, "flags"); - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) { puts_filtered (" TYPE_UNSIGNED"); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index cdd19b4..bd03df4 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -210,11 +210,6 @@ enum type_instance_flag_value : unsigned DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); -/* * Unsigned integer type. If this is not set for a TYPE_CODE_INT, - the type is signed (unless TYPE_NOSIGN (below) is set). */ - -#define TYPE_UNSIGNED(t) ((t)->is_unsigned ()) - /* * No sign for this type. In C++, "char", "signed char", and "unsigned char" are distinct types; so we need an extra flag to indicate the absence of a sign! */ @@ -1068,6 +1063,9 @@ struct type return this->bounds ()->bit_stride (); } + /* Unsigned integer type. If this is not set for a TYPE_CODE_INT, + the type is signed (unless TYPE_NOSIGN is set). */ + bool is_unsigned () const { return this->main_type->m_flag_unsigned; diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c index 419f509..c297c45 100644 --- a/gdb/guile/scm-math.c +++ b/gdb/guile/scm-math.c @@ -527,7 +527,7 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, if (is_integral_type (type) || type->code () == TYPE_CODE_PTR) { - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) { ULONGEST max; @@ -573,7 +573,7 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, static int vlscm_integer_fits_p (SCM obj, struct type *type) { - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) { ULONGEST max; diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index c4d4045..ae7937c 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -888,7 +888,7 @@ gdbscm_value_to_integer (SCM self) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) return gdbscm_scm_from_ulongest (l); else return gdbscm_scm_from_longest (l); @@ -930,7 +930,7 @@ gdbscm_value_to_real (SCM self) d = target_float_to_host_double (value_contents (value), type); check = value_from_host_double (type, d); } - else if (TYPE_UNSIGNED (type)) + else if (type->is_unsigned ()) { d = (ULONGEST) value_as_long (value); check = value_from_ulongest (type, (ULONGEST) d); diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index 521d926..963d125 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -381,7 +381,7 @@ m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) case TYPE_CODE_CHAR: if (TYPE_LENGTH (type) < sizeof (LONGEST)) { - if (!TYPE_UNSIGNED (type)) + if (!type->is_unsigned ()) { *lowp = -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1)); *highp = -*lowp - 1; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index e0f0488..b55bfba 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -5091,7 +5091,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, || typecode == TYPE_CODE_INT)) || (partial_len < 4 && typecode == TYPE_CODE_INT - && !TYPE_UNSIGNED (arg_type))) + && !arg_type->is_unsigned ())) regval = extract_signed_integer (val, partial_len, byte_order); else diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index ff2cfd0..9b9ce18 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -99,7 +99,7 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code, if (types[i]->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (types[i]) && get_array_bounds (types[i], &lowb, &highb) && TYPE_TARGET_TYPE (types[i])->code () == code - && TYPE_UNSIGNED (TYPE_TARGET_TYPE (types[i])) == flag_unsigned + && TYPE_TARGET_TYPE (types[i])->is_unsigned () == flag_unsigned && TYPE_LENGTH (TYPE_TARGET_TYPE (types[i])) == el_length && TYPE_LENGTH (types[i]) == length && highb - lowb + 1 == n) @@ -338,7 +338,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside, struct type *dst_type = lookup_opencl_vector_type (gdbarch, elm_type->code (), TYPE_LENGTH (elm_type), - TYPE_UNSIGNED (elm_type), n); + elm_type->is_unsigned (), n); if (dst_type == NULL) dst_type = init_vector_type (elm_type, n); @@ -602,7 +602,7 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, /* Check whether the vector types are compatible. */ if (eltype1->code () != eltype2->code () || TYPE_LENGTH (eltype1) != TYPE_LENGTH (eltype2) - || TYPE_UNSIGNED (eltype1) != TYPE_UNSIGNED (eltype2) + || eltype1->is_unsigned () != eltype2->is_unsigned () || lowb1 != lowb2 || highb1 != highb2) error (_("Cannot perform operation on vectors with different types")); @@ -912,7 +912,7 @@ Cannot perform conditional operation on incompatible types")); /* Throw an error if the types of arg2 or arg3 are incompatible. */ if (eltype2->code () != eltype3->code () || TYPE_LENGTH (eltype2) != TYPE_LENGTH (eltype3) - || TYPE_UNSIGNED (eltype2) != TYPE_UNSIGNED (eltype3) + || eltype2->is_unsigned () != eltype3->is_unsigned () || lowb2 != lowb3 || highb2 != highb3) error (_("\ Cannot perform operation on vectors with different types")); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 309d2ca..8fff581 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -368,7 +368,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, a negative signed value (e.g. "print/u (short)-1" should print 65535 (if shorts are 16 bits) instead of 4294967295). */ if (options->format != 'c' - && (options->format != 'd' || TYPE_UNSIGNED (type))) + && (options->format != 'd' || type->is_unsigned ())) { if (len < TYPE_LENGTH (type) && byte_order == BFD_ENDIAN_BIG) valaddr += TYPE_LENGTH (type) - len; @@ -452,7 +452,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, case 0: if (type->code () != TYPE_CODE_FLT) { - print_decimal_chars (stream, valaddr, len, !TYPE_UNSIGNED (type), + print_decimal_chars (stream, valaddr, len, !type->is_unsigned (), byte_order); break; } @@ -478,7 +478,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, val_long.emplace (unpack_long (type, valaddr)); opts.format = 0; - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) type = builtin_type (gdbarch)->builtin_true_unsigned_char; else type = builtin_type (gdbarch)->builtin_true_char; diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 2ebbe0a..2d9e77a 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -1694,7 +1694,7 @@ valpy_int (PyObject *self) GDB_PY_HANDLE_EXCEPTION (except); } - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) return gdb_py_object_from_ulongest (l).release (); else return gdb_py_object_from_longest (l).release (); @@ -1730,7 +1730,7 @@ valpy_long (PyObject *self) GDB_PY_HANDLE_EXCEPTION (except); } - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) return gdb_py_long_from_ulongest (l); else return gdb_py_long_from_longest (l); diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index a590f9d..a0310a0 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -212,7 +212,7 @@ static bool rust_u8_type_p (struct type *type) { return (type->code () == TYPE_CODE_INT - && TYPE_UNSIGNED (type) + && type->is_unsigned () && TYPE_LENGTH (type) == 1); } @@ -223,7 +223,7 @@ rust_chartype_p (struct type *type) { return (type->code () == TYPE_CODE_CHAR && TYPE_LENGTH (type) == 4 - && TYPE_UNSIGNED (type)); + && type->is_unsigned ()); } /* If VALUE represents a trait object pointer, return the underlying @@ -542,7 +542,7 @@ rust_value_print_inner (struct value *val, struct ui_file *stream, case TYPE_CODE_INT: /* Recognize the unit type. */ - if (TYPE_UNSIGNED (type) && TYPE_LENGTH (type) == 0 + if (type->is_unsigned () && TYPE_LENGTH (type) == 0 && type->name () != NULL && strcmp (type->name (), "()") == 0) { fputs_filtered ("()", stream); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 65cb237..bc6f98e 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1818,7 +1818,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg, /* Place value in least significant bits of the register or memory word and sign- or zero-extend to full word size. This also applies to a struct or union. */ - val = TYPE_UNSIGNED (type) + val = type->is_unsigned () ? extract_unsigned_integer (value_contents (arg), length, byte_order) : extract_signed_integer (value_contents (arg), @@ -2046,7 +2046,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type, if (out != NULL) regcache->cooked_read_part (S390_R2_REGNUM, word_size - length, length, out); - else if (TYPE_UNSIGNED (type)) + else if (type->is_unsigned ()) regcache_cooked_write_unsigned (regcache, S390_R2_REGNUM, extract_unsigned_integer (in, length, byte_order)); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index b30b075..054b67e 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1091,9 +1091,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, && SYMBOL_TYPE (sym)->code () == TYPE_CODE_INT) { SYMBOL_TYPE (sym) = - TYPE_UNSIGNED (SYMBOL_TYPE (sym)) - ? objfile_type (objfile)->builtin_unsigned_int - : objfile_type (objfile)->builtin_int; + (SYMBOL_TYPE (sym)->is_unsigned () + ? objfile_type (objfile)->builtin_unsigned_int + : objfile_type (objfile)->builtin_int); } break; } diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 08b9a42..f9e73fe 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -629,7 +629,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream) break; case TYPE_CODE_INT: - print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, val); + print_longest (stream, type->is_unsigned () ? 'u' : 'd', 0, val); break; case TYPE_CODE_CHAR: diff --git a/gdb/valarith.c b/gdb/valarith.c index 0221bc6..82f11db 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -883,7 +883,7 @@ value_args_as_target_float (struct value *arg1, struct value *arg2, else if (is_integral_type (type1)) { *eff_type_x = type2; - if (TYPE_UNSIGNED (type1)) + if (type1->is_unsigned ()) target_float_from_ulongest (x, *eff_type_x, value_as_long (arg1)); else target_float_from_longest (x, *eff_type_x, value_as_long (arg1)); @@ -902,7 +902,7 @@ value_args_as_target_float (struct value *arg1, struct value *arg2, else if (is_integral_type (type2)) { *eff_type_y = type1; - if (TYPE_UNSIGNED (type2)) + if (type2->is_unsigned ()) target_float_from_ulongest (y, *eff_type_y, value_as_long (arg2)); else target_float_from_longest (y, *eff_type_y, value_as_long (arg2)); @@ -940,9 +940,9 @@ promotion_type (struct type *type1, struct type *type2) result_type = type1; else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1)) result_type = type2; - else if (TYPE_UNSIGNED (type1)) + else if (type1->is_unsigned ()) result_type = type1; - else if (TYPE_UNSIGNED (type2)) + else if (type2->is_unsigned ()) result_type = type2; else result_type = type1; @@ -1162,7 +1162,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) else result_type = promotion_type (type1, type2); - if (TYPE_UNSIGNED (result_type)) + if (result_type->is_unsigned ()) { LONGEST v2_signed = value_as_long (arg2); ULONGEST v1, v2, v = 0; @@ -1497,7 +1497,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op) if (eltype1->code () != eltype2->code () || elsize != TYPE_LENGTH (eltype2) - || TYPE_UNSIGNED (eltype1) != TYPE_UNSIGNED (eltype2) + || eltype1->is_unsigned () != eltype2->is_unsigned () || low_bound1 != low_bound2 || high_bound1 != high_bound2) error (_("Cannot perform operation on vectors with different types")); diff --git a/gdb/valops.c b/gdb/valops.c index 0eb2b09..60f6041 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -462,7 +462,7 @@ value_cast (struct type *type, struct value *arg2) } /* The only option left is an integral type. */ - if (TYPE_UNSIGNED (type2)) + if (type2->is_unsigned ()) return value_from_ulongest (to_type, value_as_long (arg2)); else return value_from_longest (to_type, value_as_long (arg2)); @@ -1230,7 +1230,7 @@ value_assign (struct value *toval, struct value *fromval) LONGEST valmask = (((ULONGEST) 1) << value_bitsize (toval)) - 1; fieldval &= valmask; - if (!TYPE_UNSIGNED (type) + if (!type->is_unsigned () && (fieldval & (valmask ^ (valmask >> 1)))) fieldval |= ~valmask; diff --git a/gdb/valprint.c b/gdb/valprint.c index d95b170..676bdd6 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -769,7 +769,7 @@ generic_value_print_char (struct value *value, struct ui_file *stream, const gdb_byte *valaddr = value_contents_for_printing (value); LONGEST val = unpack_long (type, valaddr); - if (TYPE_UNSIGNED (type)) + if (type->is_unsigned ()) fprintf_filtered (stream, "%u", (unsigned int) val); else fprintf_filtered (stream, "%d", (int) val); diff --git a/gdb/value.c b/gdb/value.c index a6e2130..f5eb564 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2761,7 +2761,7 @@ unpack_long (struct type *type, const gdb_byte *valaddr) enum bfd_endian byte_order = type_byte_order (type); enum type_code code = type->code (); int len = TYPE_LENGTH (type); - int nosign = TYPE_UNSIGNED (type); + int nosign = type->is_unsigned (); switch (code) { @@ -3145,7 +3145,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr, { valmask = (((ULONGEST) 1) << bitsize) - 1; val &= valmask; - if (!TYPE_UNSIGNED (field_type)) + if (!field_type->is_unsigned ()) { if (val & (valmask ^ (valmask >> 1))) { -- cgit v1.1