diff options
145 files changed, 1744 insertions, 1746 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c945505..5533db5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-05-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (TYPE_CODE): Remove. Change all call sites to use + type::code instead. + +2020-05-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (struct type) <code, set_code>: New methods. (TYPE_CODE): Use type::code. Change all call sites used to set the code to use type::set_code instead. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 216e85d..37d75a8 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1254,7 +1254,7 @@ static ULONGEST aarch64_type_align (gdbarch *gdbarch, struct type *t) { t = check_typedef (t); - if (TYPE_CODE (t) == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) + if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) { /* Use the natural alignment for vector types (the same for scalar type), but the maximum alignment is 128-bit. */ @@ -1283,7 +1283,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type, if (type == nullptr) return -1; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: if (TYPE_LENGTH (type) > 16) @@ -1292,7 +1292,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type, if (*fundamental_type == nullptr) *fundamental_type = type; else if (TYPE_LENGTH (type) != TYPE_LENGTH (*fundamental_type) - || TYPE_CODE (type) != TYPE_CODE (*fundamental_type)) + || type->code () != (*fundamental_type)->code ()) return -1; return 1; @@ -1306,7 +1306,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type, if (*fundamental_type == nullptr) *fundamental_type = target_type; else if (TYPE_LENGTH (target_type) != TYPE_LENGTH (*fundamental_type) - || TYPE_CODE (target_type) != TYPE_CODE (*fundamental_type)) + || target_type->code () != (*fundamental_type)->code ()) return -1; return 2; @@ -1322,7 +1322,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type, if (*fundamental_type == nullptr) *fundamental_type = type; else if (TYPE_LENGTH (type) != TYPE_LENGTH (*fundamental_type) - || TYPE_CODE (type) != TYPE_CODE (*fundamental_type)) + || type->code () != (*fundamental_type)->code ()) return -1; return 1; @@ -1449,7 +1449,7 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache, { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int len = TYPE_LENGTH (type); - enum type_code typecode = TYPE_CODE (type); + enum type_code typecode = type->code (); int regnum = AARCH64_X0_REGNUM + info->ngrn; const bfd_byte *buf = value_contents (arg); @@ -1600,7 +1600,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache, struct aarch64_call_info *info, struct type *arg_type, struct value *arg) { - switch (TYPE_CODE (arg_type)) + switch (arg_type->code ()) { case TYPE_CODE_FLT: return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type), @@ -1736,7 +1736,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, continue; } - switch (TYPE_CODE (arg_type)) + switch (arg_type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -2120,12 +2120,12 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, valbuf += len; } } - else if (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_CHAR - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_PTR + else if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_CHAR + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) - || TYPE_CODE (type) == TYPE_CODE_ENUM) + || type->code () == TYPE_CODE_ENUM) { /* If the type is a plain integer, then the access is straight-forward. Otherwise we have to play around a bit @@ -2233,12 +2233,12 @@ aarch64_store_return_value (struct type *type, struct regcache *regs, valbuf += len; } } - else if (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_CHAR - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_PTR + else if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_CHAR + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) - || TYPE_CODE (type) == TYPE_CODE_ENUM) + || type->code () == TYPE_CODE_ENUM) { if (TYPE_LENGTH (type) <= X_REGISTER_SIZE) { @@ -2294,9 +2294,9 @@ aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value, gdb_byte *readbuf, const gdb_byte *writebuf) { - if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + if (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY) { if (aarch64_return_in_memory (gdbarch, valtype)) { diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index c5e1e14..15b28ac 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1386,7 +1386,7 @@ convert_char_literal (struct type *type, LONGEST val) if (type == NULL) return val; type = check_typedef (type); - if (TYPE_CODE (type) != TYPE_CODE_ENUM) + if (type->code () != TYPE_CODE_ENUM) return val; if ((val >= 'a' && val <= 'z') || (val >= '0' && val <= '9')) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 9bed643..02e3404 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -451,7 +451,7 @@ get_ada_pspace_data (struct program_space *pspace) static struct type * ada_typedef_target_type (struct type *type) { - while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + while (type->code () == TYPE_CODE_TYPEDEF) type = TYPE_TARGET_TYPE (type); return type; } @@ -750,7 +750,7 @@ LONGEST ada_discrete_type_high_bound (struct type *type) { type = resolve_dynamic_type (type, {}, 0); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: return TYPE_HIGH_BOUND (type); @@ -771,7 +771,7 @@ LONGEST ada_discrete_type_low_bound (struct type *type) { type = resolve_dynamic_type (type, {}, 0); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: return TYPE_LOW_BOUND (type); @@ -793,7 +793,7 @@ ada_discrete_type_low_bound (struct type *type) static struct type * get_base_type (struct type *type) { - while (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE) + while (type != NULL && type->code () == TYPE_CODE_RANGE) { if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL) return type; @@ -814,9 +814,9 @@ ada_get_decoded_value (struct value *value) if (ada_is_array_descriptor_type (type) || (ada_is_constrained_packed_array_type (type) - && TYPE_CODE (type) != TYPE_CODE_PTR)) + && type->code () != TYPE_CODE_PTR)) { - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) /* array access type. */ + if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */ value = ada_coerce_to_simple_array_ptr (value); else value = ada_coerce_to_simple_array (value); @@ -1510,12 +1510,12 @@ desc_base_type (struct type *type) if (type == NULL) return NULL; type = ada_check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (type->code () == TYPE_CODE_TYPEDEF) type = ada_typedef_target_type (type); if (type != NULL - && (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF)) + && (type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_REF)) return ada_check_typedef (TYPE_TARGET_TYPE (type)); else return type; @@ -1563,7 +1563,7 @@ thin_data_pntr (struct value *val) data_type = lookup_pointer_type (data_type); - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) return value_cast (data_type, value_copy (val)); else return value_from_longest (data_type, value_address (val)); @@ -1575,7 +1575,7 @@ static int is_thick_pntr (struct type *type) { type = desc_base_type (type); - return (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT + return (type != NULL && type->code () == TYPE_CODE_STRUCT && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL); } @@ -1600,7 +1600,7 @@ desc_bounds_type (struct type *type) if (r != NULL) return ada_check_typedef (r); } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) { r = lookup_struct_elt_type (type, "P_BOUNDS", 1); if (r != NULL) @@ -1629,7 +1629,7 @@ desc_bounds (struct value *arr) /* NOTE: The following calculation is not really kosher, but since desc_type is an XVE-encoded type (and shouldn't be), the correct calculation is a real pain. FIXME (and fix GCC). */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) addr = value_as_long (arr); else addr = value_address (arr); @@ -1646,7 +1646,7 @@ desc_bounds (struct value *arr) struct type *p_bounds_type = value_type (p_bounds); if (p_bounds_type - && TYPE_CODE (p_bounds_type) == TYPE_CODE_PTR) + && p_bounds_type->code () == TYPE_CODE_PTR) { struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type); @@ -1705,7 +1705,7 @@ desc_data_target_type (struct type *type) struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1); if (data_type - && TYPE_CODE (ada_check_typedef (data_type)) == TYPE_CODE_PTR) + && ada_check_typedef (data_type)->code () == TYPE_CODE_PTR) return ada_check_typedef (TYPE_TARGET_TYPE (data_type)); } @@ -1797,7 +1797,7 @@ desc_index_type (struct type *type, int i) { type = desc_base_type (type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) return lookup_struct_elt_type (type, bound_name[2 * i - 2], 1); else return NULL; @@ -1826,7 +1826,7 @@ ada_is_direct_array_type (struct type *type) if (type == NULL) return 0; type = ada_check_typedef (type); - return (TYPE_CODE (type) == TYPE_CODE_ARRAY + return (type->code () == TYPE_CODE_ARRAY || ada_is_array_descriptor_type (type)); } @@ -1836,9 +1836,9 @@ ada_is_direct_array_type (struct type *type) static int ada_is_array_type (struct type *type) { - while (type != NULL - && (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF)) + while (type != NULL + && (type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_REF)) type = TYPE_TARGET_TYPE (type); return ada_is_direct_array_type (type); } @@ -1851,10 +1851,10 @@ ada_is_simple_array_type (struct type *type) if (type == NULL) return 0; type = ada_check_typedef (type); - return (TYPE_CODE (type) == TYPE_CODE_ARRAY - || (TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type))) - == TYPE_CODE_ARRAY)); + return (type->code () == TYPE_CODE_ARRAY + || (type->code () == TYPE_CODE_PTR + && (ada_check_typedef (TYPE_TARGET_TYPE (type))->code () + == TYPE_CODE_ARRAY))); } /* Non-zero iff TYPE belongs to a GNAT array descriptor. */ @@ -1868,7 +1868,7 @@ ada_is_array_descriptor_type (struct type *type) return 0; type = ada_check_typedef (type); return (data_type != NULL - && TYPE_CODE (data_type) == TYPE_CODE_ARRAY + && data_type->code () == TYPE_CODE_ARRAY && desc_arity (desc_bounds_type (type)) > 0); } @@ -1882,7 +1882,7 @@ ada_is_bogus_array_descriptor (struct type *type) { return type != NULL - && TYPE_CODE (type) == TYPE_CODE_STRUCT + && type->code () == TYPE_CODE_STRUCT && (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL) && !ada_is_array_descriptor_type (type); @@ -2078,7 +2078,7 @@ decode_packed_array_bitsize (struct type *type) /* Access to arrays implemented as fat pointers are encoded as a typedef of the fat pointer type. We need the name of the fat pointer type to do the decoding, so strip the typedef layer. */ - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (type->code () == TYPE_CODE_TYPEDEF) type = ada_typedef_target_type (type); raw_name = ada_type_name (ada_check_typedef (type)); @@ -2128,7 +2128,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits) LONGEST low_bound, high_bound; type = ada_check_typedef (type); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY) + if (type->code () != TYPE_CODE_ARRAY) return type; index_type_desc = ada_find_parallel_type (type, "___XA"); @@ -2146,7 +2146,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits) TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits; TYPE_NAME (new_type) = ada_type_name (type); - if ((TYPE_CODE (check_typedef (index_type)) == TYPE_CODE_RANGE + if ((check_typedef (index_type)->code () == TYPE_CODE_RANGE && is_dynamic_type (check_typedef (index_type))) || get_discrete_bounds (index_type, &low_bound, &high_bound) < 0) low_bound = high_bound = 0; @@ -2197,7 +2197,7 @@ decode_constrained_packed_array_type (struct type *type) } shadow_type = check_typedef (shadow_type); - if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY) + if (shadow_type->code () != TYPE_CODE_ARRAY) { lim_warning (_("could not understand bounds " "information on packed array")); @@ -2227,7 +2227,7 @@ decode_constrained_packed_array (struct value *arr) and "value_ind" routines to perform the dereferencing, as opposed to using "ada_coerce_ref" or "ada_value_ind". */ arr = coerce_ref (arr); - if (TYPE_CODE (ada_check_typedef (value_type (arr))) == TYPE_CODE_PTR) + if (ada_check_typedef (value_type (arr))->code () == TYPE_CODE_PTR) arr = value_ind (arr); type = decode_constrained_packed_array_type (value_type (arr)); @@ -2283,7 +2283,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind) elt_type = ada_check_typedef (value_type (arr)); for (i = 0; i < arity; i += 1) { - if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY + if (elt_type->code () != TYPE_CODE_ARRAY || TYPE_FIELD_BITSIZE (elt_type, 0) == 0) error (_("attempt to do packed indexing of " @@ -2322,7 +2322,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind) static int has_negatives (struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { default: return 0; @@ -2607,8 +2607,8 @@ ada_value_assign (struct value *toval, struct value *fromval) if (VALUE_LVAL (toval) == lval_memory && bits > 0 - && (TYPE_CODE (type) == TYPE_CODE_FLT - || TYPE_CODE (type) == TYPE_CODE_STRUCT)) + && (type->code () == TYPE_CODE_FLT + || type->code () == TYPE_CODE_STRUCT)) { int len = (value_bitpos (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; @@ -2617,7 +2617,7 @@ ada_value_assign (struct value *toval, struct value *fromval) struct value *val; CORE_ADDR to_addr = value_address (toval); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) fromval = value_cast (type, fromval); read_memory (to_addr, buffer, len); @@ -2698,7 +2698,7 @@ value_assign_to_component (struct value *container, struct value *component, bool ada_is_access_to_unconstrained_array (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_TYPEDEF + return (type->code () == TYPE_CODE_TYPEDEF && is_thick_pntr (ada_typedef_target_type (type))); } @@ -2716,7 +2716,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind) elt = ada_coerce_to_simple_array (arr); elt_type = ada_check_typedef (value_type (elt)); - if (TYPE_CODE (elt_type) == TYPE_CODE_ARRAY + if (elt_type->code () == TYPE_CODE_ARRAY && TYPE_FIELD_BITSIZE (elt_type, 0) > 0) return value_subscript_packed (elt, arity, ind); @@ -2724,13 +2724,13 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind) { struct type *saved_elt_type = TYPE_TARGET_TYPE (elt_type); - if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY) + if (elt_type->code () != TYPE_CODE_ARRAY) error (_("too many subscripts (%d expected)"), k); elt = value_subscript (elt, pos_atr (ind[k])); if (ada_is_access_to_unconstrained_array (saved_elt_type) - && TYPE_CODE (value_type (elt)) != TYPE_CODE_TYPEDEF) + && value_type (elt)->code () != TYPE_CODE_TYPEDEF) { /* The element is a typedef to an unconstrained array, except that the value_subscript call stripped the @@ -2773,7 +2773,7 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind) struct type *type = check_typedef (value_enclosing_type (array_ind)); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && TYPE_FIELD_BITSIZE (type, 0) > 0) return value_subscript_packed (array_ind, arity, ind); @@ -2782,12 +2782,12 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind) LONGEST lwb, upb; struct value *lwb_value; - if (TYPE_CODE (type) != TYPE_CODE_ARRAY) + if (type->code () != TYPE_CODE_ARRAY) error (_("too many subscripts (%d expected)"), k); arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), value_copy (arr)); get_discrete_bounds (TYPE_INDEX_TYPE (type), &lwb, &upb); - lwb_value = value_from_longest (value_type(ind[k]), lwb); + lwb_value = value_from_longest (value_type (ind[k]), lwb); arr = value_ptradd (arr, pos_atr (ind[k]) - pos_atr (lwb_value)); type = TYPE_TARGET_TYPE (type); } @@ -2871,10 +2871,10 @@ ada_array_arity (struct type *type) type = desc_base_type (type); arity = 0; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) return desc_arity (desc_bounds_type (type)); else - while (TYPE_CODE (type) == TYPE_CODE_ARRAY) + while (type->code () == TYPE_CODE_ARRAY) { arity += 1; type = ada_check_typedef (TYPE_TARGET_TYPE (type)); @@ -2893,7 +2893,7 @@ ada_array_element_type (struct type *type, int nindices) { type = desc_base_type (type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { int k; struct type *p_array_type; @@ -2914,9 +2914,9 @@ ada_array_element_type (struct type *type, int nindices) } return p_array_type; } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + else if (type->code () == TYPE_CODE_ARRAY) { - while (nindices != 0 && TYPE_CODE (type) == TYPE_CODE_ARRAY) + while (nindices != 0 && type->code () == TYPE_CODE_ARRAY) { type = TYPE_TARGET_TYPE (type); nindices -= 1; @@ -2953,7 +2953,7 @@ ada_index_type (struct type *type, int n, const char *name) /* FIXME: The stabs type r(0,0);bound;bound in an array type has a target type of TYPE_CODE_UNDEF. We compensate here, but perhaps stabsread.c would make more sense. */ - if (result_type && TYPE_CODE (result_type) == TYPE_CODE_UNDEF) + if (result_type && result_type->code () == TYPE_CODE_UNDEF) result_type = NULL; } else @@ -2986,7 +2986,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which) if (arr_type == NULL || !ada_is_simple_array_type (arr_type)) return (LONGEST) - which; - if (TYPE_CODE (arr_type) == TYPE_CODE_PTR) + if (arr_type->code () == TYPE_CODE_PTR) type = TYPE_TARGET_TYPE (arr_type); else type = arr_type; @@ -3033,7 +3033,7 @@ ada_array_bound (struct value *arr, int n, int which) { struct type *arr_type; - if (TYPE_CODE (check_typedef (value_type (arr))) == TYPE_CODE_PTR) + if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR) arr = value_ind (arr); arr_type = value_enclosing_type (arr); @@ -3057,7 +3057,7 @@ ada_array_length (struct value *arr, int n) struct type *arr_type, *index_type; int low, high; - if (TYPE_CODE (check_typedef (value_type (arr))) == TYPE_CODE_PTR) + if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR) arr = value_ind (arr); arr_type = value_enclosing_type (arr); @@ -3080,7 +3080,7 @@ ada_array_length (struct value *arr, int n) if (index_type != NULL) { struct type *base_type; - if (TYPE_CODE (index_type) == TYPE_CODE_RANGE) + if (index_type->code () == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (index_type); else base_type = index_type; @@ -3208,7 +3208,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym, fprintf_filtered (stream, "%s", sym->print_name ()); if (!print_signatures || type == NULL - || TYPE_CODE (type) != TYPE_CODE_FUNC) + || type->code () != TYPE_CODE_FUNC) return; if (TYPE_NFIELDS (type) > 0) @@ -3226,7 +3226,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym, fprintf_filtered (stream, ")"); } if (TYPE_TARGET_TYPE (type) != NULL - && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { fprintf_filtered (stream, " return "); ada_print_type (TYPE_TARGET_TYPE (type), NULL, stream, -1, 0, flags); @@ -3389,7 +3389,7 @@ See set/show multiple-symbol.")); int is_enumeral = (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST && SYMBOL_TYPE (syms[i].symbol) != NULL - && TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) == TYPE_CODE_ENUM); + && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM); struct symtab *symtab = NULL; if (SYMBOL_OBJFILE_OWNED (syms[i].symbol)) @@ -3725,7 +3725,7 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, } if (deprocedure_p - && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol)) + && (SYMBOL_TYPE (exp->elts[pc + 2].symbol)->code () == TYPE_CODE_FUNC)) { replace_operator_with_call (expp, pc, 0, 4, @@ -3838,17 +3838,17 @@ ada_type_match (struct type *ftype, struct type *atype, int may_deref) ftype = ada_check_typedef (ftype); atype = ada_check_typedef (atype); - if (TYPE_CODE (ftype) == TYPE_CODE_REF) + if (ftype->code () == TYPE_CODE_REF) ftype = TYPE_TARGET_TYPE (ftype); - if (TYPE_CODE (atype) == TYPE_CODE_REF) + if (atype->code () == TYPE_CODE_REF) atype = TYPE_TARGET_TYPE (atype); - switch (TYPE_CODE (ftype)) + switch (ftype->code ()) { default: - return TYPE_CODE (ftype) == TYPE_CODE (atype); + return ftype->code () == atype->code (); case TYPE_CODE_PTR: - if (TYPE_CODE (atype) == TYPE_CODE_PTR) + if (atype->code () == TYPE_CODE_PTR) return ada_type_match (TYPE_TARGET_TYPE (ftype), TYPE_TARGET_TYPE (atype), 0); else @@ -3857,7 +3857,7 @@ ada_type_match (struct type *ftype, struct type *atype, int may_deref) case TYPE_CODE_INT: case TYPE_CODE_ENUM: case TYPE_CODE_RANGE: - switch (TYPE_CODE (atype)) + switch (atype->code ()) { case TYPE_CODE_INT: case TYPE_CODE_ENUM: @@ -3868,20 +3868,20 @@ ada_type_match (struct type *ftype, struct type *atype, int may_deref) } case TYPE_CODE_ARRAY: - return (TYPE_CODE (atype) == TYPE_CODE_ARRAY + return (atype->code () == TYPE_CODE_ARRAY || ada_is_array_descriptor_type (atype)); case TYPE_CODE_STRUCT: if (ada_is_array_descriptor_type (ftype)) - return (TYPE_CODE (atype) == TYPE_CODE_ARRAY + return (atype->code () == TYPE_CODE_ARRAY || ada_is_array_descriptor_type (atype)); else - return (TYPE_CODE (atype) == TYPE_CODE_STRUCT + return (atype->code () == TYPE_CODE_STRUCT && !ada_is_array_descriptor_type (atype)); case TYPE_CODE_UNION: case TYPE_CODE_FLT: - return (TYPE_CODE (atype) == TYPE_CODE (ftype)); + return (atype->code () == ftype->code ()); } } @@ -3897,9 +3897,9 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals) struct type *func_type = SYMBOL_TYPE (func); if (SYMBOL_CLASS (func) == LOC_CONST - && TYPE_CODE (func_type) == TYPE_CODE_ENUM) + && func_type->code () == TYPE_CODE_ENUM) return (n_actuals == 0); - else if (func_type == NULL || TYPE_CODE (func_type) != TYPE_CODE_FUNC) + else if (func_type == NULL || func_type->code () != TYPE_CODE_FUNC) return 0; if (TYPE_NFIELDS (func_type) != n_actuals) @@ -3935,7 +3935,7 @@ return_match (struct type *func_type, struct type *context_type) if (func_type == NULL) return 1; - if (TYPE_CODE (func_type) == TYPE_CODE_FUNC) + if (func_type->code () == TYPE_CODE_FUNC) return_type = get_base_type (TYPE_TARGET_TYPE (func_type)); else return_type = get_base_type (func_type); @@ -3944,12 +3944,12 @@ return_match (struct type *func_type, struct type *context_type) context_type = get_base_type (context_type); - if (TYPE_CODE (return_type) == TYPE_CODE_ENUM) + if (return_type->code () == TYPE_CODE_ENUM) return context_type == NULL || return_type == context_type; else if (context_type == NULL) - return TYPE_CODE (return_type) != TYPE_CODE_VOID; + return return_type->code () != TYPE_CODE_VOID; else - return TYPE_CODE (return_type) == TYPE_CODE (context_type); + return return_type->code () == context_type->code (); } @@ -4054,7 +4054,7 @@ numeric_type_p (struct type *type) return 0; else { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_FLT: @@ -4077,7 +4077,7 @@ integer_type_p (struct type *type) return 0; else { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: return 1; @@ -4099,7 +4099,7 @@ scalar_type_p (struct type *type) return 0; else { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_RANGE: @@ -4121,7 +4121,7 @@ discrete_type_p (struct type *type) return 0; else { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_RANGE: @@ -4342,26 +4342,26 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) v = NULL; t1 = t = ada_check_typedef (value_type (arg)); - if (TYPE_CODE (t) == TYPE_CODE_REF) + if (t->code () == TYPE_CODE_REF) { t1 = TYPE_TARGET_TYPE (t); if (t1 == NULL) goto BadValue; t1 = ada_check_typedef (t1); - if (TYPE_CODE (t1) == TYPE_CODE_PTR) + if (t1->code () == TYPE_CODE_PTR) { arg = coerce_ref (arg); t = t1; } } - while (TYPE_CODE (t) == TYPE_CODE_PTR) + while (t->code () == TYPE_CODE_PTR) { t1 = TYPE_TARGET_TYPE (t); if (t1 == NULL) goto BadValue; t1 = ada_check_typedef (t1); - if (TYPE_CODE (t1) == TYPE_CODE_PTR) + if (t1->code () == TYPE_CODE_PTR) { arg = value_ind (arg); t = t1; @@ -4370,7 +4370,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) break; } - if (TYPE_CODE (t1) != TYPE_CODE_STRUCT && TYPE_CODE (t1) != TYPE_CODE_UNION) + if (t1->code () != TYPE_CODE_STRUCT && t1->code () != TYPE_CODE_UNION) goto BadValue; if (t1 == t) @@ -4381,7 +4381,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) struct type *field_type; CORE_ADDR address; - if (TYPE_CODE (t) == TYPE_CODE_PTR) + if (t->code () == TYPE_CODE_PTR) address = value_address (ada_value_ind (arg)); else address = value_address (ada_coerce_ref (arg)); @@ -4393,7 +4393,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) a reference should mostly be transparent to the user. */ if (ada_is_tagged_type (t1, 0) - || (TYPE_CODE (t1) == TYPE_CODE_REF + || (t1->code () == TYPE_CODE_REF && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0))) { /* We first try to find the searched field in the current type. @@ -4420,7 +4420,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) { if (bit_size != 0) { - if (TYPE_CODE (t) == TYPE_CODE_REF) + if (t->code () == TYPE_CODE_REF) arg = ada_coerce_ref (arg); else arg = ada_value_ind (arg); @@ -4457,24 +4457,24 @@ ada_convert_actual (struct value *actual, struct type *formal_type0) struct type *actual_type = ada_check_typedef (value_type (actual)); struct type *formal_type = ada_check_typedef (formal_type0); struct type *formal_target = - TYPE_CODE (formal_type) == TYPE_CODE_PTR + formal_type->code () == TYPE_CODE_PTR ? ada_check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type; struct type *actual_target = - TYPE_CODE (actual_type) == TYPE_CODE_PTR + actual_type->code () == TYPE_CODE_PTR ? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type; if (ada_is_array_descriptor_type (formal_target) - && TYPE_CODE (actual_target) == TYPE_CODE_ARRAY) + && actual_target->code () == TYPE_CODE_ARRAY) return make_array_descriptor (formal_type, actual); - else if (TYPE_CODE (formal_type) == TYPE_CODE_PTR - || TYPE_CODE (formal_type) == TYPE_CODE_REF) + else if (formal_type->code () == TYPE_CODE_PTR + || formal_type->code () == TYPE_CODE_REF) { struct value *result; - if (TYPE_CODE (formal_target) == TYPE_CODE_ARRAY + if (formal_target->code () == TYPE_CODE_ARRAY && ada_is_array_descriptor_type (actual_target)) result = desc_data (actual); - else if (TYPE_CODE (formal_type) != TYPE_CODE_PTR) + else if (formal_type->code () != TYPE_CODE_PTR) { if (VALUE_LVAL (actual) != lval_memory) { @@ -4493,7 +4493,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0) return actual; return value_cast_pointers (formal_type, result, 0); } - else if (TYPE_CODE (actual_type) == TYPE_CODE_PTR) + else if (actual_type->code () == TYPE_CODE_PTR) return ada_value_ind (actual); else if (ada_is_aligner_type (formal_type)) { @@ -4575,7 +4575,7 @@ make_array_descriptor (struct type *type, struct value *arr) descriptor = ensure_lval (descriptor); - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) return value_addr (descriptor); else return descriptor; @@ -4761,8 +4761,8 @@ is_nonfunction (struct block_symbol syms[], int n) int i; for (i = 0; i < n; i += 1) - if (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_FUNC - && (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_ENUM + if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_FUNC + && (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM || SYMBOL_CLASS (syms[i].symbol) != LOC_CONST)) return 1; @@ -4778,10 +4778,10 @@ equiv_types (struct type *type0, struct type *type1) if (type0 == type1) return 1; if (type0 == NULL || type1 == NULL - || TYPE_CODE (type0) != TYPE_CODE (type1)) + || type0->code () != type1->code ()) return 0; - if ((TYPE_CODE (type0) == TYPE_CODE_STRUCT - || TYPE_CODE (type0) == TYPE_CODE_ENUM) + if ((type0->code () == TYPE_CODE_STRUCT + || type0->code () == TYPE_CODE_ENUM) && ada_type_name (type0) != NULL && ada_type_name (type1) != NULL && strcmp (ada_type_name (type0), ada_type_name (type1)) == 0) return 1; @@ -4814,7 +4814,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) int len0 = strlen (name0); return - TYPE_CODE (type0) == TYPE_CODE (type1) + type0->code () == type1->code () && (equiv_types (type0, type1) || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0 && startswith (name1 + len0, "___XV"))); @@ -5035,7 +5035,7 @@ symbols_are_identical_enums (const std::vector<struct block_symbol> &syms) /* Quick check: All symbols should have an enum type. */ for (i = 0; i < syms.size (); i++) - if (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_ENUM) + if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM) return 0; /* Quick check: They should all have the same value. */ @@ -6503,7 +6503,7 @@ ada_is_dispatch_table_ptr_type (struct type *type) { const char *name; - if (TYPE_CODE (type) != TYPE_CODE_PTR) + if (type->code () != TYPE_CODE_PTR) return 0; name = TYPE_NAME (TYPE_TARGET_TYPE (type)); @@ -6583,7 +6583,7 @@ ada_is_tag_type (struct type *type) { type = ada_check_typedef (type); - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_PTR) + if (type == NULL || type->code () != TYPE_CODE_PTR) return 0; else { @@ -6673,8 +6673,7 @@ ada_tag_value_at_base_address (struct value *obj) /* It is the responsability of the caller to deref pointers. */ - if (TYPE_CODE (obj_type) == TYPE_CODE_PTR - || TYPE_CODE (obj_type) == TYPE_CODE_REF) + if (obj_type->code () == TYPE_CODE_PTR || obj_type->code () == TYPE_CODE_REF) return obj; tag = ada_value_tag (obj); @@ -6866,7 +6865,7 @@ ada_parent_type (struct type *type) type = ada_check_typedef (type); - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT) + if (type == NULL || type->code () != TYPE_CODE_STRUCT) return NULL; for (i = 0; i < TYPE_NFIELDS (type); i += 1) @@ -6875,7 +6874,7 @@ ada_parent_type (struct type *type) struct type *parent_type = TYPE_FIELD_TYPE (type, i); /* If the _parent field is a pointer, then dereference it. */ - if (TYPE_CODE (parent_type) == TYPE_CODE_PTR) + if (parent_type->code () == TYPE_CODE_PTR) parent_type = TYPE_TARGET_TYPE (parent_type); /* If there is a parallel XVS type, get the actual base type. */ parent_type = ada_get_base_type (parent_type); @@ -6942,9 +6941,9 @@ ada_is_variant_part (struct type *type, int field_num) struct type *field_type = TYPE_FIELD_TYPE (type, field_num); - return (TYPE_CODE (field_type) == TYPE_CODE_UNION - || (is_dynamic_field (type, field_num) - && (TYPE_CODE (TYPE_TARGET_TYPE (field_type)) + return (field_type->code () == TYPE_CODE_UNION + || (is_dynamic_field (type, field_num) + && (TYPE_TARGET_TYPE (field_type)->code () == TYPE_CODE_UNION))); } @@ -6987,7 +6986,7 @@ ada_variant_discrim_name (struct type *type0) const char *discrim_end; const char *discrim_start; - if (TYPE_CODE (type0) == TYPE_CODE_PTR) + if (type0->code () == TYPE_CODE_PTR) type = TYPE_TARGET_TYPE (type0); else type = type0; @@ -7520,15 +7519,14 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, while (1) { type = ada_check_typedef (type); - if (TYPE_CODE (type) != TYPE_CODE_PTR - && TYPE_CODE (type) != TYPE_CODE_REF) + if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF) break; type = TYPE_TARGET_TYPE (type); } if (type == NULL - || (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION)) + || (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION)) { if (noerr) return NULL; @@ -7731,7 +7729,7 @@ ada_value_ind (struct value *val0) static struct value * ada_coerce_ref (struct value *val0) { - if (TYPE_CODE (value_type (val0)) == TYPE_CODE_REF) + if (value_type (val0)->code () == TYPE_CODE_REF) { struct value *val = val0; @@ -7832,9 +7830,9 @@ ada_prefer_type (struct type *type0, struct type *type1) return 1; else if (type0 == NULL) return 0; - else if (TYPE_CODE (type1) == TYPE_CODE_VOID) + else if (type1->code () == TYPE_CODE_VOID) return 1; - else if (TYPE_CODE (type0) == TYPE_CODE_VOID) + else if (type0->code () == TYPE_CODE_VOID) return 0; else if (TYPE_NAME (type1) == NULL && TYPE_NAME (type0) != NULL) return 1; @@ -7974,7 +7972,7 @@ dynamic_template_type (struct type *type) { type = ada_check_typedef (type); - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT + if (type == NULL || type->code () != TYPE_CODE_STRUCT || ada_type_name (type) == NULL) return NULL; else @@ -7997,7 +7995,7 @@ is_dynamic_field (struct type *templ_type, int field_num) const char *name = TYPE_FIELD_NAME (templ_type, field_num); return name != NULL - && TYPE_CODE (TYPE_FIELD_TYPE (templ_type, field_num)) == TYPE_CODE_PTR + && TYPE_FIELD_TYPE (templ_type, field_num)->code () == TYPE_CODE_PTR && strstr (name, "___XVL") != NULL; } @@ -8009,7 +8007,7 @@ variant_field_index (struct type *type) { int f; - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT) + if (type == NULL || type->code () != TYPE_CODE_STRUCT) return -1; for (f = 0; f < TYPE_NFIELDS (type); f += 1) @@ -8208,7 +8206,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, the length of our field. If this is a typedef, get the length of the target type, not the length of the typedef. */ - if (TYPE_CODE (field_type) == TYPE_CODE_TYPEDEF) + if (field_type->code () == TYPE_CODE_TYPEDEF) field_type = ada_typedef_target_type (field_type); fld_bit_len = @@ -8358,7 +8356,7 @@ template_to_static_fixed_type (struct type *type0) if (type == type0) { TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0); - type->set_code (TYPE_CODE(type0)); + type->set_code (type0->code ()); INIT_NONE_SPECIFIC (type); TYPE_NFIELDS (type) = nfields; TYPE_FIELDS (type) = (struct field *) @@ -8509,7 +8507,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr, struct type *templ_type; struct type *var_type; - if (TYPE_CODE (var_type0) == TYPE_CODE_PTR) + if (var_type0->code () == TYPE_CODE_PTR) var_type = TYPE_TARGET_TYPE (var_type0); else var_type = var_type0; @@ -8549,10 +8547,10 @@ ada_is_redundant_range_encoding (struct type *range_type, int n; LONGEST lo, hi; - gdb_assert (TYPE_CODE (range_type) == TYPE_CODE_RANGE); + gdb_assert (range_type->code () == TYPE_CODE_RANGE); - if (TYPE_CODE (get_base_type (range_type)) - != TYPE_CODE (get_base_type (encoding_type))) + if (get_base_type (range_type)->code () + != get_base_type (encoding_type)->code ()) { /* The compiler probably used a simple base type to describe the range type instead of the range's actual base type, @@ -8780,7 +8778,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, if (!HAVE_GNAT_AUX_INFO (type)) return type; - switch (TYPE_CODE (type)) + switch (type->code ()) { default: return type; @@ -8928,7 +8926,7 @@ ada_to_fixed_type (struct type *type, const gdb_byte *valaddr, only in that situation. But this seems unnecessary so far, probably because we call check_typedef/ada_check_typedef pretty much everywhere. */ - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF + if (type->code () == TYPE_CODE_TYPEDEF && (TYPE_MAIN_TYPE (ada_typedef_target_type (type)) == TYPE_MAIN_TYPE (fixed_type))) return type; @@ -8952,7 +8950,7 @@ to_static_fixed_type (struct type *type0) type0 = ada_check_typedef (type0); - switch (TYPE_CODE (type0)) + switch (type0->code ()) { default: return type0; @@ -9025,7 +9023,7 @@ ada_check_typedef (struct type *type) return type; type = check_typedef (type); - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM + if (type == NULL || type->code () != TYPE_CODE_ENUM || !TYPE_STUB (type) || TYPE_NAME (type) == NULL) return type; @@ -9041,7 +9039,7 @@ ada_check_typedef (struct type *type) stubs pointing to arrays, as we don't create symbols for array types, only for the typedef-to-array types). If that's the case, strip the typedef layer. */ - if (TYPE_CODE (type1) == TYPE_CODE_TYPEDEF) + if (type1->code () == TYPE_CODE_TYPEDEF) type1 = ada_check_typedef (type1); return type1; @@ -9152,7 +9150,7 @@ value_val_atr (struct type *type, struct value *arg) if (!integer_type_p (value_type (arg))) error (_("'VAL requires integral argument")); - if (TYPE_CODE (type) == TYPE_CODE_ENUM) + if (type->code () == TYPE_CODE_ENUM) { long pos = value_as_long (arg); @@ -9178,15 +9176,15 @@ ada_is_character_type (struct type *type) /* If the type code says it's a character, then assume it really is, and don't check any further. */ - if (TYPE_CODE (type) == TYPE_CODE_CHAR) + if (type->code () == TYPE_CODE_CHAR) return true; /* Otherwise, assume it's a character type iff it is a discrete type with a known character type name. */ name = ada_type_name (type); return (name != NULL - && (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_RANGE) + && (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_RANGE) && (strcmp (name, "character") == 0 || strcmp (name, "wide_character") == 0 || strcmp (name, "wide_wide_character") == 0 @@ -9200,7 +9198,7 @@ ada_is_string_type (struct type *type) { type = ada_check_typedef (type); if (type != NULL - && TYPE_CODE (type) != TYPE_CODE_PTR + && type->code () != TYPE_CODE_PTR && (ada_is_simple_array_type (type) || ada_is_array_descriptor_type (type)) && ada_array_arity (type) == 1) @@ -9236,7 +9234,7 @@ ada_is_aligner_type (struct type *type) if (!trust_pad_over_xvs && ada_find_parallel_type (type, "___XVS") != NULL) return 0; - return (TYPE_CODE (type) == TYPE_CODE_STRUCT + return (type->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1 && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0); } @@ -9250,7 +9248,7 @@ ada_get_base_type (struct type *raw_type) struct type *real_type_namer; struct type *raw_real_type; - if (raw_type == NULL || TYPE_CODE (raw_type) != TYPE_CODE_STRUCT) + if (raw_type == NULL || raw_type->code () != TYPE_CODE_STRUCT) return raw_type; if (ada_is_aligner_type (raw_type)) @@ -9270,11 +9268,11 @@ ada_get_base_type (struct type *raw_type) real_type_namer = ada_find_parallel_type (raw_type, "___XVS"); if (real_type_namer == NULL - || TYPE_CODE (real_type_namer) != TYPE_CODE_STRUCT + || real_type_namer->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (real_type_namer) != 1) return raw_type; - if (TYPE_CODE (TYPE_FIELD_TYPE (real_type_namer, 0)) != TYPE_CODE_REF) + if (TYPE_FIELD_TYPE (real_type_namer, 0)->code () != TYPE_CODE_REF) { /* This is an older encoding form where the base type needs to be looked up by name. We prefer the newer encoding because it is @@ -9513,9 +9511,9 @@ ada_promote_array_of_integrals (struct type *type, struct value *val) /* Verify that both val and type are arrays of scalars, and that the size of val's elements is smaller than the size of type's element. */ - gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY); + gdb_assert (type->code () == TYPE_CODE_ARRAY); gdb_assert (is_integral_type (TYPE_TARGET_TYPE (type))); - gdb_assert (TYPE_CODE (value_type (val)) == TYPE_CODE_ARRAY); + gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY); gdb_assert (is_integral_type (TYPE_TARGET_TYPE (value_type (val)))); gdb_assert (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val)))); @@ -9551,15 +9549,15 @@ coerce_for_assign (struct type *type, struct value *val) type2 = ada_check_typedef (type2); type = ada_check_typedef (type); - if (TYPE_CODE (type2) == TYPE_CODE_PTR - && TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type2->code () == TYPE_CODE_PTR + && type->code () == TYPE_CODE_ARRAY) { val = ada_value_ind (val); type2 = value_type (val); } - if (TYPE_CODE (type2) == TYPE_CODE_ARRAY - && TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type2->code () == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY) { if (!ada_same_array_size_p (type, type2)) error (_("cannot assign arrays of different length")); @@ -9594,8 +9592,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) type1 = get_base_type (ada_check_typedef (value_type (arg1))); type2 = get_base_type (ada_check_typedef (value_type (arg2))); - if (TYPE_CODE (type1) != TYPE_CODE_INT - || TYPE_CODE (type2) != TYPE_CODE_INT) + if (type1->code () != TYPE_CODE_INT + || type2->code () != TYPE_CODE_INT) return value_binop (arg1, arg2, op); switch (op) @@ -9659,8 +9657,8 @@ ada_value_equal (struct value *arg1, struct value *arg2) arg1_type = ada_check_typedef (value_type (arg1)); arg2_type = ada_check_typedef (value_type (arg2)); - if (TYPE_CODE (arg1_type) != TYPE_CODE_ARRAY - || TYPE_CODE (arg2_type) != TYPE_CODE_ARRAY) + if (arg1_type->code () != TYPE_CODE_ARRAY + || arg2_type->code () != TYPE_CODE_ARRAY) error (_("Attempt to compare array with non-array")); /* FIXME: The following works only for types whose representations use all bits (no padding or undefined bits) @@ -9714,7 +9712,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index, struct value *elt; struct type *lhs_type = check_typedef (value_type (lhs)); - if (TYPE_CODE (lhs_type) == TYPE_CODE_ARRAY) + if (lhs_type->code () == TYPE_CODE_ARRAY) { struct type *index_type = builtin_type (exp->gdbarch)->builtin_int; struct value *index_val = value_from_longest (index_type, index); @@ -9781,7 +9779,7 @@ assign_aggregate (struct value *container, low_index = TYPE_ARRAY_LOWER_BOUND_VALUE (lhs_type); high_index = TYPE_ARRAY_UPPER_BOUND_VALUE (lhs_type); } - else if (TYPE_CODE (lhs_type) == TYPE_CODE_STRUCT) + else if (lhs_type->code () == TYPE_CODE_STRUCT) { low_index = 0; high_index = num_visible_fields (lhs_type) - 1; @@ -10375,7 +10373,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, result = evaluate_subexp_standard (expect_type, exp, pos, noside); /* The result type will have code OP_STRING, bashed there from OP_ARRAY. Bash it back. */ - if (TYPE_CODE (value_type (result)) == TYPE_CODE_STRING) + if (value_type (result)->code () == TYPE_CODE_STRING) value_type (result)->set_code (TYPE_CODE_ARRAY); return result; } @@ -10427,11 +10425,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) + if (value_type (arg1)->code () == TYPE_CODE_PTR) return (value_from_longest (value_type (arg1), value_as_long (arg1) + value_as_long (arg2))); - if (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR) + if (value_type (arg2)->code () == TYPE_CODE_PTR) return (value_from_longest (value_type (arg2), value_as_long (arg1) + value_as_long (arg2))); @@ -10443,7 +10441,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, argument. We cannot cast the result to a reference type, so if ARG1 is a reference type, find its underlying type. */ type = value_type (arg1); - while (TYPE_CODE (type) == TYPE_CODE_REF) + while (type->code () == TYPE_CODE_REF) type = TYPE_TARGET_TYPE (type); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); return value_cast (type, value_binop (arg1, arg2, BINOP_ADD)); @@ -10453,11 +10451,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) + if (value_type (arg1)->code () == TYPE_CODE_PTR) return (value_from_longest (value_type (arg1), value_as_long (arg1) - value_as_long (arg2))); - if (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR) + if (value_type (arg2)->code () == TYPE_CODE_PTR) return (value_from_longest (value_type (arg2), value_as_long (arg1) - value_as_long (arg2))); @@ -10470,7 +10468,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, argument. We cannot cast the result to a reference type, so if ARG1 is a reference type, find its underlying type. */ type = value_type (arg1); - while (TYPE_CODE (type) == TYPE_CODE_REF) + while (type->code () == TYPE_CODE_REF) type = TYPE_TARGET_TYPE (type); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); return value_cast (type, value_binop (arg1, arg2, BINOP_SUB)); @@ -10579,7 +10577,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, The latter should be shown as usual (as a pointer), whereas a reference should mostly be transparent to the user. */ if (ada_is_tagged_type (type, 0) - || (TYPE_CODE (type) == TYPE_CODE_REF + || (type->code () == TYPE_CODE_REF && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))) { /* Tagged types are a little special in the fact that the real @@ -10601,7 +10599,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type in the type description. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL); - if (TYPE_CODE (type) != TYPE_CODE_REF) + if (type->code () != TYPE_CODE_REF) { struct type *actual_type; @@ -10634,9 +10632,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, For instance, a case statement in a variant record would be replaced by the relevant components based on the actual value of the discriminants. */ - if ((TYPE_CODE (type) == TYPE_CODE_STRUCT + if ((type->code () == TYPE_CODE_STRUCT && dynamic_template_type (type) != NULL) - || (TYPE_CODE (type) == TYPE_CODE_UNION + || (type->code () == TYPE_CODE_UNION && ada_find_parallel_type (type, "___XVU") != NULL)) { *pos += 4; @@ -10672,13 +10670,13 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (ada_is_constrained_packed_array_type (desc_base_type (value_type (argvec[0])))) argvec[0] = ada_coerce_to_simple_array (argvec[0]); - else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY + else if (value_type (argvec[0])->code () == TYPE_CODE_ARRAY && TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0) /* This is a packed array that has already been fixed, and therefore already coerced to a simple array. Nothing further to do. */ ; - else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF) + else if (value_type (argvec[0])->code () == TYPE_CODE_REF) { /* Make sure we dereference references so that all the code below feels like it's really handling the referenced value. Wrapping @@ -10686,7 +10684,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, well. */ argvec[0] = ada_to_fixed_value (coerce_ref (argvec[0])); } - else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY + else if (value_type (argvec[0])->code () == TYPE_CODE_ARRAY && VALUE_LVAL (argvec[0]) == lval_memory) argvec[0] = value_addr (argvec[0]); @@ -10695,12 +10693,12 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, /* Ada allows us to implicitly dereference arrays when subscripting them. So, if this is an array typedef (encoding use for array access types encoded as fat pointers), strip it now. */ - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (type->code () == TYPE_CODE_TYPEDEF) type = ada_typedef_target_type (type); - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { - switch (TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type)))) + switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()) { case TYPE_CODE_FUNC: type = ada_check_typedef (TYPE_TARGET_TYPE (type)); @@ -10719,7 +10717,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, } } - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FUNC: if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -10810,7 +10808,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, /* If this is a reference to an aligner type, then remove all the aligners. */ - if (TYPE_CODE (value_type (array)) == TYPE_CODE_REF + if (value_type (array)->code () == TYPE_CODE_REF && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array)))) TYPE_TARGET_TYPE (value_type (array)) = ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))); @@ -10820,8 +10818,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, /* If this is a reference to an array or an array lvalue, convert to a pointer. */ - if (TYPE_CODE (value_type (array)) == TYPE_CODE_REF - || (TYPE_CODE (value_type (array)) == TYPE_CODE_ARRAY + if (value_type (array)->code () == TYPE_CODE_REF + || (value_type (array)->code () == TYPE_CODE_ARRAY && VALUE_LVAL (array) == lval_memory)) array = value_addr (array); @@ -10835,8 +10833,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, /* If we have more than one level of pointer indirection, dereference the value until we get only one level. */ - while (TYPE_CODE (value_type (array)) == TYPE_CODE_PTR - && (TYPE_CODE (TYPE_TARGET_TYPE (value_type (array))) + while (value_type (array)->code () == TYPE_CODE_PTR + && (TYPE_TARGET_TYPE (value_type (array))->code () == TYPE_CODE_PTR)) array = value_ind (array); @@ -10847,7 +10845,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (!ada_is_simple_array_type (value_type (array))) error (_("cannot take slice of non-array")); - if (TYPE_CODE (ada_check_typedef (value_type (array))) + if (ada_check_typedef (value_type (array))->code () == TYPE_CODE_PTR) { struct type *type0 = ada_check_typedef (value_type (array)); @@ -10881,7 +10879,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) goto nosideret; - switch (TYPE_CODE (type)) + switch (type->code ()) { default: lim_warning (_("Membership test incompletely implemented; " @@ -11044,7 +11042,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, const char *name = ada_type_name (type_arg); range_type = NULL; - if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM) + if (name != NULL && type_arg->code () != TYPE_CODE_ENUM) range_type = to_fixed_range_type (type_arg, NULL); if (range_type == NULL) range_type = type_arg; @@ -11062,7 +11060,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, error (_("the 'length attribute applies only to array types")); } } - else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT) + else if (type_arg->code () == TYPE_CODE_FLT) error (_("unimplemented type attribute")); else { @@ -11158,7 +11156,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, /* If the argument is a reference, then dereference its type, since the user is really asking for the size of the actual object, not the size of the pointer. */ - if (TYPE_CODE (type) == TYPE_CODE_REF) + if (type->code () == TYPE_CODE_REF) type = TYPE_TARGET_TYPE (type); if (noside == EVAL_SKIP) @@ -11233,18 +11231,18 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, error (_("Attempt to dereference null array pointer.")); return value_at_lazy (arrType, 0); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF + else if (type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_REF /* In C you can dereference an array to get the 1st elt. */ - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + || type->code () == TYPE_CODE_ARRAY) { /* As mentioned in the OP_VAR_VALUE case, tagged types can only be determined by inspecting the object's tag. This means that we need to evaluate completely the expression in order to get its type. */ - if ((TYPE_CODE (type) == TYPE_CODE_REF - || TYPE_CODE (type) == TYPE_CODE_PTR) + if ((type->code () == TYPE_CODE_REF + || type->code () == TYPE_CODE_PTR) && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)) { arg1 = evaluate_subexp (NULL_TYPE, exp, &preeval_pos, @@ -11260,7 +11258,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, ada_ensure_varsize_limit (type); return value_zero (type, lval_memory); } - else if (TYPE_CODE (type) == TYPE_CODE_INT) + else if (type->code () == TYPE_CODE_INT) { /* GDB allows dereferencing an int. */ if (expect_type == NULL) @@ -11279,7 +11277,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */ type = ada_check_typedef (value_type (arg1)); - if (TYPE_CODE (type) == TYPE_CODE_INT) + if (type->code () == TYPE_CODE_INT) /* GDB allows dereferencing an int. If we were given the expect_type, then use that as the target type. Otherwise, assume that the target type is an int. */ @@ -11396,7 +11394,7 @@ static const char * fixed_type_info (struct type *type) { const char *name = ada_type_name (type); - enum type_code code = (type == NULL) ? TYPE_CODE_UNDEF : TYPE_CODE (type); + enum type_code code = (type == NULL) ? TYPE_CODE_UNDEF : type->code (); if ((code == TYPE_CODE_INT || code == TYPE_CODE_RANGE) && name != NULL) { @@ -11597,7 +11595,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval) gdb_assert (raw_type != NULL); gdb_assert (TYPE_NAME (raw_type) != NULL); - if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) + if (raw_type->code () == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (raw_type); else base_type = raw_type; @@ -11699,8 +11697,8 @@ ada_is_modular_type (struct type *type) { struct type *subranged_type = get_base_type (type); - return (subranged_type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE - && TYPE_CODE (subranged_type) == TYPE_CODE_INT + return (subranged_type != NULL && type->code () == TYPE_CODE_RANGE + && subranged_type->code () == TYPE_CODE_INT && TYPE_UNSIGNED (subranged_type)); } @@ -13662,7 +13660,7 @@ ada_print_subexp (struct expression *exp, int *pos, case OP_ATR_VAL: if (exp->elts[*pos].opcode == OP_TYPE) { - if (TYPE_CODE (exp->elts[*pos + 1].type) != TYPE_CODE_VOID) + if (exp->elts[*pos + 1].type->code () != TYPE_CODE_VOID) LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0, &type_print_raw_options); *pos += 3; diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 2663353..1288e16 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -431,9 +431,9 @@ read_fat_string_value (char *dest, struct value *val, int max_len) bounds_fieldno = ada_get_field_index (type, "P_BOUNDS", 0); bounds_type = TYPE_FIELD_TYPE (type, bounds_fieldno); - if (TYPE_CODE (bounds_type) == TYPE_CODE_PTR) + if (bounds_type->code () == TYPE_CODE_PTR) bounds_type = TYPE_TARGET_TYPE (bounds_type); - if (TYPE_CODE (bounds_type) != TYPE_CODE_STRUCT) + if (bounds_type->code () != TYPE_CODE_STRUCT) error (_("Unknown task name format. Aborting")); upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0); @@ -890,10 +890,10 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) struct type *eltype = NULL; struct type *idxtype = NULL; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) eltype = check_typedef (TYPE_TARGET_TYPE (type)); if (eltype != NULL - && TYPE_CODE (eltype) == TYPE_CODE_PTR) + && eltype->code () == TYPE_CODE_PTR) idxtype = check_typedef (TYPE_INDEX_TYPE (type)); if (idxtype != NULL && !TYPE_LOW_BOUND_UNDEFINED (idxtype) @@ -933,7 +933,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) /* Validate. */ struct type *type = check_typedef (SYMBOL_TYPE (sym)); - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { data->known_tasks_element = type; return; diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index 7ef8bd5..0ae8f93 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -101,7 +101,7 @@ type_is_full_subrange_of_target_type (struct type *type) { struct type *subtype; - if (TYPE_CODE (type) != TYPE_CODE_RANGE) + if (type->code () != TYPE_CODE_RANGE) return 0; subtype = TYPE_TARGET_TYPE (type); @@ -146,7 +146,7 @@ print_range (struct type *type, struct ui_file *stream, type = TYPE_TARGET_TYPE (type); } - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: case TYPE_CODE_ENUM: @@ -208,7 +208,7 @@ print_range_bound (struct type *type, const char *bounds, int *n, to indicate default output 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) + if (bounds[*n - 1] == 'm' && type->code () == TYPE_CODE_INT) type = NULL; ada_print_scalar (type, B, stream); if (bounds[*n] == '_') @@ -270,7 +270,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream, name = TYPE_NAME (raw_type); gdb_assert (name != NULL); - if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) + if (raw_type->code () == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (raw_type); else base_type = raw_type; @@ -402,7 +402,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show, bitsize = 0; if (range_desc_type == NULL) { - for (arr_type = type; TYPE_CODE (arr_type) == TYPE_CODE_ARRAY; + for (arr_type = type; arr_type->code () == TYPE_CODE_ARRAY; arr_type = TYPE_TARGET_TYPE (arr_type)) { if (arr_type != type) @@ -552,10 +552,10 @@ print_variant_clauses (struct type *type, int field_num, var_type = TYPE_FIELD_TYPE (type, field_num); discr_type = ada_variant_discrim_type (var_type, outer_type); - if (TYPE_CODE (var_type) == TYPE_CODE_PTR) + if (var_type->code () == TYPE_CODE_PTR) { var_type = TYPE_TARGET_TYPE (var_type); - if (var_type == NULL || TYPE_CODE (var_type) != TYPE_CODE_UNION) + if (var_type == NULL || var_type->code () != TYPE_CODE_UNION) return; } @@ -898,7 +898,7 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name, int i, len = TYPE_NFIELDS (type); if (TYPE_TARGET_TYPE (type) != NULL - && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID) fprintf_filtered (stream, "procedure"); else fprintf_filtered (stream, "function"); @@ -928,7 +928,7 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name, if (TYPE_TARGET_TYPE (type) == NULL) fprintf_filtered (stream, " return <unknown return type>"); - else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + else if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { fprintf_filtered (stream, " return "); ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags); @@ -970,7 +970,7 @@ ada_print_type (struct type *type0, const char *varstring, if (show > 0) type = ada_check_typedef (type); - if (is_var_decl && TYPE_CODE (type) != TYPE_CODE_FUNC) + if (is_var_decl && type->code () != TYPE_CODE_FUNC) fprintf_filtered (stream, "%.*s: ", ada_name_prefix_len (varstring), varstring); @@ -984,10 +984,10 @@ ada_print_type (struct type *type0, const char *varstring, if (ada_is_aligner_type (type)) ada_print_type (ada_aligned_type (type), "", stream, show, level, flags); else if (ada_is_constrained_packed_array_type (type) - && TYPE_CODE (type) != TYPE_CODE_PTR) + && type->code () != TYPE_CODE_PTR) print_array_type (type, stream, show, level, flags); else - switch (TYPE_CODE (type)) + switch (type->code ()) { default: fprintf_filtered (stream, "<"); diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 010446d..4ad4b54 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -41,7 +41,7 @@ static int print_field_values (struct value *, struct value *, static void adjust_type_signedness (struct type *type) { - if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE + if (type != NULL && type->code () == TYPE_CODE_RANGE && TYPE_LOW_BOUND (type) >= 0) TYPE_UNSIGNED (type) = 1; } @@ -73,7 +73,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type, index_type = TYPE_INDEX_TYPE (type); - while (TYPE_CODE (index_type) == TYPE_CODE_RANGE) + while (index_type->code () == TYPE_CODE_RANGE) { /* We need to know what the base type is, in order to do the appropriate check below. Otherwise, if this is a subrange @@ -84,7 +84,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type, } /* Don't print the lower bound if it's the default one. */ - switch (TYPE_CODE (index_type)) + switch (index_type->code ()) { case TYPE_CODE_BOOL: case TYPE_CODE_CHAR: @@ -141,12 +141,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr, else len = high - low + 1; - if (TYPE_CODE (index_type) == TYPE_CODE_RANGE) + if (index_type->code () == TYPE_CODE_RANGE) base_index_type = TYPE_TARGET_TYPE (index_type); else base_index_type = index_type; - if (TYPE_CODE (base_index_type) == TYPE_CODE_ENUM) + if (base_index_type->code () == TYPE_CODE_ENUM) { LONGEST low_pos, high_pos; @@ -396,7 +396,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream) type = ada_check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ENUM: @@ -749,13 +749,13 @@ ada_val_print_gnat_array (struct value *val, of the case where ADDRESS is meaningless because original_value was not an lval. */ val = coerce_ref (val); - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) /* array access type. */ + if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */ val = ada_coerce_to_simple_array_ptr (val); else val = ada_coerce_to_simple_array (val); if (val == NULL) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_TYPEDEF); + gdb_assert (type->code () == TYPE_CODE_TYPEDEF); fprintf_filtered (stream, "0x0"); } else @@ -805,10 +805,10 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse, fputs_filtered (str.c_str (), stream); return; } - else if (TYPE_CODE (type) == TYPE_CODE_RANGE - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ENUM - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_BOOL - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR)) + else if (type->code () == TYPE_CODE_RANGE + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM + || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL + || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR)) { /* For enum-valued ranges, we want to recurse, because we'll end up printing the constant's name rather than its numeric @@ -992,7 +992,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr, struct value *deref_val; CORE_ADDR deref_val_int; - if (TYPE_CODE (elttype) == TYPE_CODE_UNDEF) + if (elttype->code () == TYPE_CODE_UNDEF) { fputs_styled ("<ref to undefined type>", metadata_style.style (), stream); @@ -1048,7 +1048,7 @@ ada_value_print_1 (struct value *val, struct ui_file *stream, int recurse, if (ada_is_array_descriptor_type (type) || (ada_is_constrained_packed_array_type (type) - && TYPE_CODE (type) != TYPE_CODE_PTR)) + && type->code () != TYPE_CODE_PTR)) { ada_val_print_gnat_array (val, stream, recurse, options); return; @@ -1069,7 +1069,7 @@ ada_value_print_1 (struct value *val, struct ui_file *stream, int recurse, deprecated_set_value_type (val, type); } - switch (TYPE_CODE (type)) + switch (type->code ()) { default: common_val_print (val, stream, recurse, options, @@ -1145,12 +1145,12 @@ ada_value_print (struct value *val0, struct ui_file *stream, struct value_print_options opts; /* If it is a pointer, indicate what it points to. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { /* Hack: don't print (char *) for char strings. Their type is indicated by the quoted string anyway. */ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char) - || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_INT + || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT || TYPE_UNSIGNED (TYPE_TARGET_TYPE (type))) { fprintf_filtered (stream, "("); @@ -1163,7 +1163,7 @@ ada_value_print (struct value *val0, struct ui_file *stream, /* We do not print the type description unless TYPE is an array access type (this is encoded by the compiler as a typedef to a fat pointer - hence the check against TYPE_CODE_TYPEDEF). */ - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (type->code () == TYPE_CODE_TYPEDEF) { fprintf_filtered (stream, "("); type_print (type, "", stream, -1); diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c index a86ac18..98dc9d1 100644 --- a/gdb/ada-varobj.c +++ b/gdb/ada-varobj.c @@ -132,11 +132,11 @@ ada_varobj_ind (struct value *parent_value, ada_get_decoded_value would have transformed our parent_type into a simple array pointer type. */ gdb_assert (parent_value == NULL); - gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF); + gdb_assert (parent_type->code () == TYPE_CODE_TYPEDEF); /* Decode parent_type by the equivalent pointer to (decoded) array. */ - while (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF) + while (parent_type->code () == TYPE_CODE_TYPEDEF) parent_type = TYPE_TARGET_TYPE (parent_type); parent_type = ada_coerce_to_simple_array_type (parent_type); parent_type = lookup_pointer_type (parent_type); @@ -206,9 +206,9 @@ ada_varobj_adjust_for_child_access (struct value **value, one child (the struct), their children are the components of the struct/union type. We handle this situation by dereferencing the (value, type) couple. */ - if (TYPE_CODE (*type) == TYPE_CODE_PTR - && (TYPE_CODE (TYPE_TARGET_TYPE (*type)) == TYPE_CODE_STRUCT - || TYPE_CODE (TYPE_TARGET_TYPE (*type)) == TYPE_CODE_UNION) + if ((*type)->code () == TYPE_CODE_PTR + && (TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_STRUCT + || TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION) && !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type)) && !ada_is_constrained_packed_array_type (TYPE_TARGET_TYPE (*type))) ada_varobj_ind (*value, *type, value, type); @@ -270,8 +270,8 @@ ada_varobj_get_struct_number_of_children (struct value *parent_value, int n_children = 0; int i; - gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT - || TYPE_CODE (parent_type) == TYPE_CODE_UNION); + gdb_assert (parent_type->code () == TYPE_CODE_STRUCT + || parent_type->code () == TYPE_CODE_UNION); for (i = 0; i < TYPE_NFIELDS (parent_type); i++) { @@ -329,8 +329,8 @@ ada_varobj_get_ptr_number_of_children (struct value *parent_value, /* Pointer to functions and to void do not have a child, since you cannot print what they point to. */ - if (TYPE_CODE (child_type) == TYPE_CODE_FUNC - || TYPE_CODE (child_type) == TYPE_CODE_VOID) + if (child_type->code () == TYPE_CODE_FUNC + || child_type->code () == TYPE_CODE_VOID) return 0; /* All other types have 1 child. */ @@ -353,16 +353,16 @@ ada_varobj_get_number_of_children (struct value *parent_value, if (ada_is_access_to_unconstrained_array (parent_type)) return 1; - if (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY) + if (parent_type->code () == TYPE_CODE_ARRAY) return ada_varobj_get_array_number_of_children (parent_value, parent_type); - if (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT - || TYPE_CODE (parent_type) == TYPE_CODE_UNION) + if (parent_type->code () == TYPE_CODE_STRUCT + || parent_type->code () == TYPE_CODE_UNION) return ada_varobj_get_struct_number_of_children (parent_value, parent_type); - if (TYPE_CODE (parent_type) == TYPE_CODE_PTR) + if (parent_type->code () == TYPE_CODE_PTR) return ada_varobj_get_ptr_number_of_children (parent_value, parent_type); @@ -418,8 +418,8 @@ ada_varobj_describe_struct_child (struct value *parent_value, int fieldno; int childno = 0; - gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT - || TYPE_CODE (parent_type) == TYPE_CODE_UNION); + gdb_assert (parent_type->code () == TYPE_CODE_STRUCT + || parent_type->code () == TYPE_CODE_UNION); for (fieldno = 0; fieldno < TYPE_NFIELDS (parent_type); fieldno++) { @@ -587,7 +587,7 @@ ada_varobj_describe_simple_array_child (struct value *parent_value, struct type *index_type; int real_index; - gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY); + gdb_assert (parent_type->code () == TYPE_CODE_ARRAY); index_type = TYPE_INDEX_TYPE (parent_type); real_index = child_index + ada_discrete_type_low_bound (index_type); @@ -627,11 +627,11 @@ ada_varobj_describe_simple_array_child (struct value *parent_value, std::string decoded; /* If the index type is a range type, find the base type. */ - while (TYPE_CODE (index_type) == TYPE_CODE_RANGE) + while (index_type->code () == TYPE_CODE_RANGE) index_type = TYPE_TARGET_TYPE (index_type); - if (TYPE_CODE (index_type) == TYPE_CODE_ENUM - || TYPE_CODE (index_type) == TYPE_CODE_BOOL) + if (index_type->code () == TYPE_CODE_ENUM + || index_type->code () == TYPE_CODE_BOOL) { index_type_name = ada_type_name (index_type); if (index_type_name) @@ -693,7 +693,7 @@ ada_varobj_describe_child (struct value *parent_value, return; } - if (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY) + if (parent_type->code () == TYPE_CODE_ARRAY) { ada_varobj_describe_simple_array_child (parent_value, parent_type, parent_name, parent_path_expr, @@ -702,8 +702,8 @@ ada_varobj_describe_child (struct value *parent_value, return; } - if (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT - || TYPE_CODE (parent_type) == TYPE_CODE_UNION) + if (parent_type->code () == TYPE_CODE_STRUCT + || parent_type->code () == TYPE_CODE_UNION) { ada_varobj_describe_struct_child (parent_value, parent_type, parent_name, parent_path_expr, @@ -713,7 +713,7 @@ ada_varobj_describe_child (struct value *parent_value, return; } - if (TYPE_CODE (parent_type) == TYPE_CODE_PTR) + if (parent_type->code () == TYPE_CODE_PTR) { ada_varobj_describe_ptr_child (parent_value, parent_type, parent_name, parent_path_expr, @@ -856,7 +856,7 @@ ada_varobj_get_value_of_variable (struct value *value, { ada_varobj_decode_var (&value, &type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -939,7 +939,7 @@ ada_value_is_changeable_p (const struct varobj *var) struct type *type = (var->value != nullptr ? value_type (var->value.get ()) : var->type); - if (TYPE_CODE (type) == TYPE_CODE_REF) + if (type->code () == TYPE_CODE_REF) type = TYPE_TARGET_TYPE (type); if (ada_is_access_to_unconstrained_array (type)) diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index aabd202..377d7b1 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -327,7 +327,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct type *arg_type = check_typedef (value_type (arg)); /* Cast argument to long if necessary as the compiler does it too. */ - switch (TYPE_CODE (arg_type)) + switch (arg_type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -478,7 +478,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache, gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; ULONGEST l; - switch (TYPE_CODE (valtype)) + switch (valtype->code ()) { case TYPE_CODE_FLT: switch (TYPE_LENGTH (valtype)) @@ -546,7 +546,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache, gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; ULONGEST l; - switch (TYPE_CODE (valtype)) + switch (valtype->code ()) { case TYPE_CODE_FLT: switch (TYPE_LENGTH (valtype)) @@ -614,7 +614,7 @@ alpha_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index c846447..9fa5d2b 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -546,8 +546,8 @@ static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]) static bool amd64_has_unaligned_fields (struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) { for (int i = 0; i < TYPE_NFIELDS (type); i++) { @@ -603,8 +603,8 @@ amd64_classify_aggregate_field (struct type *type, int i, if (field_is_static (&TYPE_FIELD (type, i)) || bitsize == 0) return; - if (TYPE_CODE (subtype) == TYPE_CODE_STRUCT - || TYPE_CODE (subtype) == TYPE_CODE_UNION) + if (subtype->code () == TYPE_CODE_STRUCT + || subtype->code () == TYPE_CODE_UNION) { /* Each field of an object is classified recursively. */ int j; @@ -667,7 +667,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2]) calculated according to the classes of the fields in the eightbyte: */ - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type)); @@ -681,8 +681,8 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2]) int i; /* Structure or union. */ - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); for (i = 0; i < TYPE_NFIELDS (type); i++) amd64_classify_aggregate_field (type, i, theclass, 0); @@ -708,7 +708,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2]) static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); int len = TYPE_LENGTH (type); theclass[0] = theclass[1] = AMD64_NO_CLASS; diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 740152b..487dfd4 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -48,7 +48,7 @@ static int amd64_windows_dummy_call_integer_regs[] = static int amd64_windows_passed_by_integer_register (struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_ENUM: @@ -76,8 +76,8 @@ amd64_windows_passed_by_integer_register (struct type *type) static int amd64_windows_passed_by_xmm_register (struct type *type) { - return ((TYPE_CODE (type) == TYPE_CODE_FLT - || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + return ((type->code () == TYPE_CODE_FLT + || type->code () == TYPE_CODE_DECFLOAT) && (TYPE_LENGTH (type) == 4 || TYPE_LENGTH (type) == 8)); } @@ -296,7 +296,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function, /* See if our value is returned through a register. If it is, then store the associated register number in REGNUM. */ - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: case TYPE_CODE_DECFLOAT: diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index b690e6e..7e6d29c 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -893,8 +893,8 @@ arc_return_value (struct gdbarch *gdbarch, struct value *function, function passes a hidden first parameter to the callee (in R0). That parameter is the address at which the value being returned should be stored. Otherwise, the result is returned in registers. */ - int is_struct_return = (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION + int is_struct_return = (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION || TYPE_LENGTH (valtype) > 2 * ARC_REGISTER_SIZE); if (arc_debug) @@ -1916,7 +1916,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc, static ULONGEST arc_type_align (struct gdbarch *gdbarch, struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_FUNC: diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index d881791..40bffbb 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3306,7 +3306,7 @@ static ULONGEST arm_type_align (gdbarch *gdbarch, struct type *t) { t = check_typedef (t); - if (TYPE_CODE (t) == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) + if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) { /* Use the natural alignment for vector types (the same for scalar type), but the maximum alignment is 64-bit. */ @@ -3393,7 +3393,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type) { t = check_typedef (t); - switch (TYPE_CODE (t)) + switch (t->code ()) { case TYPE_CODE_FLT: switch (TYPE_LENGTH (t)) @@ -3615,7 +3615,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Determine the type of this function and whether the VFP ABI applies. */ ftype = check_typedef (value_type (function)); - if (TYPE_CODE (ftype) == TYPE_CODE_PTR) + if (ftype->code () == TYPE_CODE_PTR) ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype); @@ -3660,7 +3660,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, arg_type = check_typedef (value_type (args[argnum])); len = TYPE_LENGTH (arg_type); target_type = TYPE_TARGET_TYPE (arg_type); - typecode = TYPE_CODE (arg_type); + typecode = arg_type->code (); val = value_contents (args[argnum]); align = type_align (arg_type); @@ -3758,7 +3758,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, the THUMB bit in it. */ if (TYPE_CODE_PTR == typecode && target_type != NULL - && TYPE_CODE_FUNC == TYPE_CODE (check_typedef (target_type))) + && TYPE_CODE_FUNC == check_typedef (target_type)->code ()) { CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order); if (arm_pc_is_thumb (gdbarch, regval)) @@ -3990,7 +3990,7 @@ arm_register_type (struct gdbarch *gdbarch, int regnum) struct type *t = tdesc_register_type (gdbarch, regnum); if (regnum >= ARM_D0_REGNUM && regnum < ARM_D0_REGNUM + 32 - && TYPE_CODE (t) == TYPE_CODE_FLT + && t->code () == TYPE_CODE_FLT && gdbarch_tdep (gdbarch)->have_neon) return arm_neon_double_type (gdbarch); else @@ -7805,7 +7805,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs, struct gdbarch *gdbarch = regs->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - if (TYPE_CODE_FLT == TYPE_CODE (type)) + if (TYPE_CODE_FLT == type->code ()) { switch (gdbarch_tdep (gdbarch)->fp_model) { @@ -7840,12 +7840,12 @@ arm_extract_return_value (struct type *type, struct regcache *regs, break; } } - else if (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_CHAR - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_PTR + else if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_CHAR + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) - || TYPE_CODE (type) == TYPE_CODE_ENUM) + || type->code () == TYPE_CODE_ENUM) { /* If the type is a plain integer, then the access is straight-forward. Otherwise we have to play around a bit @@ -7901,7 +7901,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type) /* Simple, non-aggregate types (ie not including vectors and complex) are always returned in a register (or registers). */ - code = TYPE_CODE (type); + code = type->code (); if (TYPE_CODE_STRUCT != code && TYPE_CODE_UNION != code && TYPE_CODE_ARRAY != code && TYPE_CODE_COMPLEX != code) return 0; @@ -7975,8 +7975,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type) enum type_code field_type_code; field_type_code - = TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, - i))); + = check_typedef (TYPE_FIELD_TYPE (type, i))->code (); /* Is it a floating point type field? */ if (field_type_code == TYPE_CODE_FLT) @@ -8014,7 +8013,7 @@ arm_store_return_value (struct type *type, struct regcache *regs, struct gdbarch *gdbarch = regs->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) { gdb_byte buf[ARM_FP_REGISTER_SIZE]; @@ -8044,12 +8043,12 @@ arm_store_return_value (struct type *type, struct regcache *regs, break; } } - else if (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_CHAR - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_PTR + else if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_CHAR + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) - || TYPE_CODE (type) == TYPE_CODE_ENUM) + || type->code () == TYPE_CODE_ENUM) { if (TYPE_LENGTH (type) <= 4) { @@ -8145,15 +8144,15 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function, return RETURN_VALUE_REGISTER_CONVENTION; } - if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + if (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY) { if (tdep->struct_return == pcc_struct_return || arm_return_in_memory (gdbarch, valtype)) return RETURN_VALUE_STRUCT_CONVENTION; } - else if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX) + else if (valtype->code () == TYPE_CODE_COMPLEX) { if (arm_return_in_memory (gdbarch, valtype)) return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index d823c87..fd602e3 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -314,8 +314,8 @@ avr_address_to_pointer (struct gdbarch *gdbarch, avr_convert_iaddr_to_raw (addr)); } /* Is it a code address? */ - else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) + else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC + || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD) { /* A code pointer is word (16 bits) addressed. We shift the address down by 1 bit to convert it to a pointer. */ @@ -345,8 +345,8 @@ avr_pointer_to_address (struct gdbarch *gdbarch, return avr_make_iaddr (addr); } /* Is it a code address? */ - else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD + else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC + || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) { /* A code pointer is word (16 bits) addressed so we shift it up @@ -935,9 +935,9 @@ avr_return_value (struct gdbarch *gdbarch, struct value *function, register holds the LSB. */ int lsb_reg; - if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + if ((valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY) && TYPE_LENGTH (valtype) > 8) return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 14765bd..57ba210 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -362,7 +362,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value) { int string_trace = 0; if (ax->trace_string - && TYPE_CODE (value->type) == TYPE_CODE_PTR + && value->type->code () == TYPE_CODE_PTR && c_textual_element_type (check_typedef (TYPE_TARGET_TYPE (value->type)), 's')) string_trace = 1; @@ -429,8 +429,8 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value) /* To trace C++ classes with static fields stored elsewhere. */ if (ax->tracing - && (TYPE_CODE (value->type) == TYPE_CODE_STRUCT - || TYPE_CODE (value->type) == TYPE_CODE_UNION)) + && (value->type->code () == TYPE_CODE_STRUCT + || value->type->code () == TYPE_CODE_UNION)) gen_trace_static_fields (ax, value->type); } @@ -474,10 +474,10 @@ gen_fetch (struct agent_expr *ax, struct type *type) ax_trace_quick (ax, TYPE_LENGTH (type)); } - if (TYPE_CODE (type) == TYPE_CODE_RANGE) + if (type->code () == TYPE_CODE_RANGE) type = TYPE_TARGET_TYPE (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_REF: @@ -775,10 +775,10 @@ require_rvalue (struct agent_expr *ax, struct axs_value *value) /* Only deal with scalars, structs and such may be too large to fit in a stack entry. */ value->type = check_typedef (value->type); - if (TYPE_CODE (value->type) == TYPE_CODE_ARRAY - || TYPE_CODE (value->type) == TYPE_CODE_STRUCT - || TYPE_CODE (value->type) == TYPE_CODE_UNION - || TYPE_CODE (value->type) == TYPE_CODE_FUNC) + if (value->type->code () == TYPE_CODE_ARRAY + || value->type->code () == TYPE_CODE_STRUCT + || value->type->code () == TYPE_CODE_UNION + || value->type->code () == TYPE_CODE_FUNC) error (_("Value not scalar: cannot be an rvalue.")); switch (value->kind) @@ -831,7 +831,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value) the stack. Should we tweak the type? */ /* Some types require special handling. */ - switch (TYPE_CODE (value->type)) + switch (value->type->code ()) { /* Functions get converted to a pointer to the function. */ case TYPE_CODE_FUNC: @@ -943,8 +943,8 @@ gen_usual_arithmetic (struct agent_expr *ax, struct axs_value *value1, struct axs_value *value2) { /* Do the usual binary conversions. */ - if (TYPE_CODE (value1->type) == TYPE_CODE_INT - && TYPE_CODE (value2->type) == TYPE_CODE_INT) + if (value1->type->code () == TYPE_CODE_INT + && value2->type->code () == TYPE_CODE_INT) { /* The ANSI integral promotions seem to work this way: Order the integer types by size, and then by signedness: an n-bit @@ -1003,7 +1003,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type) /* Dereference typedefs. */ type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_REF: @@ -1070,7 +1070,7 @@ gen_ptradd (struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2) { gdb_assert (pointer_type (value1->type)); - gdb_assert (TYPE_CODE (value2->type) == TYPE_CODE_INT); + gdb_assert (value2->type->code () == TYPE_CODE_INT); gen_scale (ax, aop_mul, value1->type); ax_simple (ax, aop_add); @@ -1086,7 +1086,7 @@ gen_ptrsub (struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2) { gdb_assert (pointer_type (value1->type)); - gdb_assert (TYPE_CODE (value2->type) == TYPE_CODE_INT); + gdb_assert (value2->type->code () == TYPE_CODE_INT); gen_scale (ax, aop_mul, value1->type); ax_simple (ax, aop_sub); @@ -1158,8 +1158,8 @@ gen_binop (struct agent_expr *ax, struct axs_value *value, int may_carry, const char *name) { /* We only handle INT op INT. */ - if ((TYPE_CODE (value1->type) != TYPE_CODE_INT) - || (TYPE_CODE (value2->type) != TYPE_CODE_INT)) + if ((value1->type->code () != TYPE_CODE_INT) + || (value2->type->code () != TYPE_CODE_INT)) error (_("Invalid combination of types in %s."), name); ax_simple (ax, @@ -1175,8 +1175,8 @@ static void gen_logical_not (struct agent_expr *ax, struct axs_value *value, struct type *result_type) { - if (TYPE_CODE (value->type) != TYPE_CODE_INT - && TYPE_CODE (value->type) != TYPE_CODE_PTR) + if (value->type->code () != TYPE_CODE_INT + && value->type->code () != TYPE_CODE_PTR) error (_("Invalid type of operand to `!'.")); ax_simple (ax, aop_log_not); @@ -1187,7 +1187,7 @@ gen_logical_not (struct agent_expr *ax, struct axs_value *value, static void gen_complement (struct agent_expr *ax, struct axs_value *value) { - if (TYPE_CODE (value->type) != TYPE_CODE_INT) + if (value->type->code () != TYPE_CODE_INT) error (_("Invalid type of operand to `~'.")); ax_simple (ax, aop_bit_not); @@ -1214,9 +1214,9 @@ gen_deref (struct axs_value *value) T" to "T", and mark the value as an lvalue in memory. Leave it to the consumer to actually dereference it. */ value->type = check_typedef (TYPE_TARGET_TYPE (value->type)); - if (TYPE_CODE (value->type) == TYPE_CODE_VOID) + if (value->type->code () == TYPE_CODE_VOID) error (_("Attempt to dereference a generic pointer.")); - value->kind = ((TYPE_CODE (value->type) == TYPE_CODE_FUNC) + value->kind = ((value->type->code () == TYPE_CODE_FUNC) ? axs_rvalue : axs_lvalue_memory); } @@ -1228,7 +1228,7 @@ gen_address_of (struct axs_value *value) /* Special case for taking the address of a function. The ANSI standard describes this as a special case, too, so this arrangement is not without motivation. */ - if (TYPE_CODE (value->type) == TYPE_CODE_FUNC) + if (value->type->code () == TYPE_CODE_FUNC) /* The value's already an rvalue on the stack, so we just need to change the type. */ value->type = lookup_pointer_type (value->type); @@ -1518,8 +1518,8 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value, type = check_typedef (value->type); /* This must yield a structure or a union. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) error (_("The left operand of `%s' is not a %s."), operator_name, operand_name); @@ -1583,8 +1583,8 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value, struct type *t = type; int i; - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION) internal_error (__FILE__, __LINE__, _("non-aggregate type to gen_struct_elt_for_reference")); @@ -1668,7 +1668,7 @@ static int gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value, struct type *type, char *field) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -1716,7 +1716,7 @@ gen_repeat (struct expression *exp, union exp_element **pc, if (!v) error (_("Right operand of `@' must be a " "constant, in agent expressions.")); - if (TYPE_CODE (value_type (v)) != TYPE_CODE_INT) + if (value_type (v)->code () != TYPE_CODE_INT) error (_("Right operand of `@' must be an integer.")); length = value_as_long (v); if (length <= 0) @@ -1788,7 +1788,7 @@ gen_expr_for_cast (struct expression *exp, union exp_element **pc, } else gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile); - if (TYPE_CODE (value->type) == TYPE_CODE_ERROR) + if (value->type->code () == TYPE_CODE_ERROR) value->type = to_type; (*pc) += 4; } @@ -2010,7 +2010,7 @@ gen_expr (struct expression *exp, union exp_element **pc, error (_("`%s' has been optimized out, cannot use"), (*pc)[2].symbol->print_name ()); - if (TYPE_CODE (value->type) == TYPE_CODE_ERROR) + if (value->type->code () == TYPE_CODE_ERROR) error_unknown_type ((*pc)[2].symbol->print_name ()); (*pc) += 4; @@ -2019,7 +2019,7 @@ gen_expr (struct expression *exp, union exp_element **pc, case OP_VAR_MSYM_VALUE: gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile); - if (TYPE_CODE (value->type) == TYPE_CODE_ERROR) + if (value->type->code () == TYPE_CODE_ERROR) error_unknown_type ((*pc)[2].msymbol->linkage_name ()); (*pc) += 4; @@ -2289,7 +2289,7 @@ gen_expr_binop_rest (struct expression *exp, switch (op) { case BINOP_ADD: - if (TYPE_CODE (value1->type) == TYPE_CODE_INT + if (value1->type->code () == TYPE_CODE_INT && pointer_type (value2->type)) { /* Swap the values and proceed normally. */ @@ -2297,7 +2297,7 @@ gen_expr_binop_rest (struct expression *exp, gen_ptradd (ax, value, value2, value1); } else if (pointer_type (value1->type) - && TYPE_CODE (value2->type) == TYPE_CODE_INT) + && value2->type->code () == TYPE_CODE_INT) gen_ptradd (ax, value, value1, value2); else gen_binop (ax, value, value1, value2, @@ -2305,7 +2305,7 @@ gen_expr_binop_rest (struct expression *exp, break; case BINOP_SUB: if (pointer_type (value1->type) - && TYPE_CODE (value2->type) == TYPE_CODE_INT) + && value2->type->code () == TYPE_CODE_INT) gen_ptrsub (ax,value, value1, value2); else if (pointer_type (value1->type) && pointer_type (value2->type)) @@ -2351,8 +2351,8 @@ gen_expr_binop_rest (struct expression *exp, an array or pointer type (like a plain int variable for example), then report this as an error. */ type = check_typedef (value1->type); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_PTR) + if (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_PTR) { if (TYPE_NAME (type)) error (_("cannot subscript something of type `%s'"), diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 09c3eed..05c26bc 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -429,11 +429,11 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr) /* If we found a pointer to function, then the resolved type is the type of the pointed-to function. */ - if (TYPE_CODE (resolver_ret_type) == TYPE_CODE_PTR) + if (resolver_ret_type->code () == TYPE_CODE_PTR) { struct type *resolved_type = TYPE_TARGET_TYPE (resolver_ret_type); - if (TYPE_CODE (check_typedef (resolved_type)) == TYPE_CODE_FUNC) + if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC) return resolved_type; } } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 22ddb3d..480f095 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1806,8 +1806,8 @@ update_watchpoint (struct watchpoint *b, int reparse) for it explicitly, never if they just happen to appear in the middle of some value chain. */ if (v == result - || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT - && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) + || (vtype->code () != TYPE_CODE_STRUCT + && vtype->code () != TYPE_CODE_ARRAY)) { CORE_ADDR addr; enum target_hw_bp_type type; @@ -10806,8 +10806,8 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals) explicitly, never if they just happen to appear in a middle of some value chain. */ if (v == head - || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT - && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) + || (vtype->code () != TYPE_CODE_STRUCT + && vtype->code () != TYPE_CODE_ARRAY)) { CORE_ADDR vaddr = value_address (v); int len; diff --git a/gdb/c-exp.y b/gdb/c-exp.y index f84691a..e737c66 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1852,10 +1852,10 @@ typename_stoken (const char *type) static int type_aggregate_p (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_NAMESPACE - || (TYPE_CODE (type) == TYPE_CODE_ENUM + return (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_NAMESPACE + || (type->code () == TYPE_CODE_ENUM && TYPE_DECLARED_CLASS (type))); } @@ -1870,7 +1870,7 @@ check_parameter_typelist (std::vector<struct type *> *params) for (ix = 0; ix < params->size (); ++ix) { type = (*params)[ix]; - if (type != NULL && TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID) + if (type != NULL && check_typedef (type)->code () == TYPE_CODE_VOID) { if (ix == 0) { diff --git a/gdb/c-lang.c b/gdb/c-lang.c index c335044..9d4064f 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -86,7 +86,7 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch, { const char *name = TYPE_NAME (elttype); - if (TYPE_CODE (elttype) == TYPE_CODE_CHAR || !name) + if (elttype->code () == TYPE_CODE_CHAR || !name) { result = C_CHAR; goto done; @@ -110,7 +110,7 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch, goto done; } - if (TYPE_CODE (elttype) != TYPE_CODE_TYPEDEF) + if (elttype->code () != TYPE_CODE_TYPEDEF) break; /* Call for side effects. */ @@ -250,12 +250,12 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer, if (element_type == NULL) goto error; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { /* If we know the size of the array, we can use it as a limit on the number of characters to be fetched. */ if (TYPE_NFIELDS (type) == 1 - && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE) + && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_RANGE) { LONGEST low_bound, high_bound; @@ -266,7 +266,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer, else fetchlimit = UINT_MAX; } - else if (TYPE_CODE (type) == TYPE_CODE_PTR) + else if (type->code () == TYPE_CODE_PTR) fetchlimit = UINT_MAX; else /* We work only with arrays and pointers. */ @@ -292,7 +292,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer, avoids running off the end of the value's contents. */ if ((VALUE_LVAL (value) == not_lval || VALUE_LVAL (value) == lval_internalvar - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + || type->code () == TYPE_CODE_ARRAY) && fetchlimit != UINT_MAX && (*length < 0 || *length <= fetchlimit)) { @@ -322,7 +322,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer, c_style_arrays is false, so we handle that specially here. */ CORE_ADDR addr; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { if (VALUE_LVAL (value) != lval_memory) error (_("Attempt to take address of value " @@ -629,13 +629,13 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, /* If the caller expects an array of some integral type, satisfy them. If something odder is expected, rely on the caller to cast. */ - if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_ARRAY) + if (expect_type && expect_type->code () == TYPE_CODE_ARRAY) { struct type *element_type = check_typedef (TYPE_TARGET_TYPE (expect_type)); - if (TYPE_CODE (element_type) == TYPE_CODE_INT - || TYPE_CODE (element_type) == TYPE_CODE_CHAR) + if (element_type->code () == TYPE_CODE_INT + || element_type->code () == TYPE_CODE_CHAR) { type = element_type; satisfy_expected = 1; @@ -742,13 +742,13 @@ bool c_is_string_type_p (struct type *type) { type = check_typedef (type); - while (TYPE_CODE (type) == TYPE_CODE_REF) + while (type->code () == TYPE_CODE_REF) { type = TYPE_TARGET_TYPE (type); type = check_typedef (type); } - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: { diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index aaf9e0d..356e605 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -116,7 +116,7 @@ c_print_type_1 (struct type *type, type = check_typedef (type); local_name = typedef_hash_table::find_typedef (flags, type); - code = TYPE_CODE (type); + code = type->code (); if (local_name != NULL) { fputs_filtered (local_name, stream); @@ -209,7 +209,7 @@ c_print_typedef (struct type *type, if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0 || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))), new_symbol->linkage_name ()) != 0 - || TYPE_CODE (SYMBOL_TYPE (new_symbol)) == TYPE_CODE_TYPEDEF) + || SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF) fprintf_filtered (stream, " %s", new_symbol->print_name ()); fprintf_filtered (stream, ";"); } @@ -327,7 +327,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix, struct type *domain; gdb_assert (nargs > 0); - gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR); + gdb_assert (args[0].type->code () == TYPE_CODE_PTR); domain = TYPE_TARGET_TYPE (args[0].type); if (TYPE_CONST (domain)) @@ -378,7 +378,7 @@ c_type_print_varspec_prefix (struct type *type, QUIT; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), @@ -421,7 +421,7 @@ c_type_print_varspec_prefix (struct type *type, c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, show, 1, 0, language, flags, podata); - fprintf_filtered (stream, TYPE_CODE(type) == TYPE_CODE_REF ? "&" : "&&"); + fprintf_filtered (stream, type->code () == TYPE_CODE_REF ? "&" : "&&"); c_type_print_modifier (type, stream, 1, need_post_space, language); break; @@ -767,7 +767,7 @@ c_type_print_varspec_suffix (struct type *type, QUIT; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: { @@ -1056,7 +1056,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, } c_type_print_modifier (type, stream, 0, 1, language); - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) fprintf_filtered (stream, "union "); else if (TYPE_DECLARED_CLASS (type)) fprintf_filtered (stream, "class "); @@ -1179,8 +1179,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, int newshow = show - 1; if (!is_static && flags->print_offsets - && (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_STRUCT - || TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION)) + && (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_STRUCT + || TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION)) { /* If we're printing offsets and this field's type is either a struct or an union, then we're interested in @@ -1401,7 +1401,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i); /* Dereference the typedef declaration itself. */ - gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF); + gdb_assert (target->code () == TYPE_CODE_TYPEDEF); target = TYPE_TARGET_TYPE (target); if (need_access_label) @@ -1492,16 +1492,16 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, way. */ if (language == language_c || language == language_minimal) { - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) fprintf_filtered (stream, "union "); - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) { if (TYPE_DECLARED_CLASS (type)) fprintf_filtered (stream, "class "); else fprintf_filtered (stream, "struct "); } - else if (TYPE_CODE (type) == TYPE_CODE_ENUM) + else if (type->code () == TYPE_CODE_ENUM) fprintf_filtered (stream, "enum "); } @@ -1511,7 +1511,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_TYPEDEF: /* If we get here, the typedef doesn't have a name, and we @@ -1702,7 +1702,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, /* At least for dump_symtab, it is important that this not be an error (). */ fprintf_styled (stream, metadata_style.style (), - _("<invalid type code %d>"), TYPE_CODE (type)); + _("<invalid type code %d>"), type->code ()); } break; } diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 52ea5ed..d117248 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -66,11 +66,11 @@ c_textual_element_type (struct type *type, char format) true_type = check_typedef (type); /* TYPE_CODE_CHAR is always textual. */ - if (TYPE_CODE (true_type) == TYPE_CODE_CHAR) + if (true_type->code () == TYPE_CODE_CHAR) return 1; /* Any other character-like types must be integral. */ - if (TYPE_CODE (true_type) != TYPE_CODE_INT) + if (true_type->code () != TYPE_CODE_INT) return 0; /* We peel typedefs one by one, looking for a match. */ @@ -81,7 +81,7 @@ c_textual_element_type (struct type *type, char format) if (TYPE_NAME (iter_type) && textual_name (TYPE_NAME (iter_type))) return 1; - if (TYPE_CODE (iter_type) != TYPE_CODE_TYPEDEF) + if (iter_type->code () != TYPE_CODE_TYPEDEF) break; /* Peel a single typedef. If the typedef doesn't have a target @@ -97,7 +97,7 @@ c_textual_element_type (struct type *type, char format) { /* Print this as a string if we can manage it. For now, no wide character support. */ - if (TYPE_CODE (true_type) == TYPE_CODE_INT + if (true_type->code () == TYPE_CODE_INT && TYPE_LENGTH (true_type) == 1) return 1; } @@ -106,7 +106,7 @@ c_textual_element_type (struct type *type, char format) /* If a one-byte TYPE_CODE_INT is missing the not-a-character flag, then we treat it as text; otherwise, we assume it's being used as data. */ - if (TYPE_CODE (true_type) == TYPE_CODE_INT + if (true_type->code () == TYPE_CODE_INT && TYPE_LENGTH (true_type) == 1 && !TYPE_NOTTEXT (true_type)) return 1; @@ -146,7 +146,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype, int want_space = 0; struct gdbarch *gdbarch = get_type_arch (type); - if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) + if (elttype->code () == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ print_function_pointer_address (options, gdbarch, address, stream); @@ -365,7 +365,7 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse, { struct type *type = check_typedef (value_type (val)); - if (TYPE_CODE (type) == TYPE_CODE_UNION && recurse && !options->unionprint) + if (type->code () == TYPE_CODE_UNION && recurse && !options->unionprint) fprintf_filtered (stream, "{...}"); else if (options->vtblprint && cp_is_vtbl_ptr_type (type)) { @@ -443,7 +443,7 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, const gdb_byte *valaddr = value_contents_for_printing (val); type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: c_value_print_array (val, stream, recurse, options); @@ -512,7 +512,7 @@ c_value_print (struct value *val, struct ui_file *stream, type = check_typedef (value_type (val)); - if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)) + if (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)) { struct type *original_type = value_type (val); @@ -520,7 +520,7 @@ c_value_print (struct value *val, struct ui_file *stream, type is indicated by the quoted string anyway. (Don't use c_textual_element_type here; quoted strings are always exactly (char *), (wchar_t *), or the like. */ - if (TYPE_CODE (original_type) == TYPE_CODE_PTR + if (original_type->code () == TYPE_CODE_PTR && TYPE_NAME (original_type) == NULL && TYPE_NAME (TYPE_TARGET_TYPE (original_type)) != NULL && (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (original_type)), @@ -530,7 +530,7 @@ c_value_print (struct value *val, struct ui_file *stream, /* Print nothing. */ } else if (options->objectprint - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) { int is_ref = TYPE_IS_REFERENCE (type); enum type_code refcode = TYPE_CODE_UNDEF; @@ -538,7 +538,7 @@ c_value_print (struct value *val, struct ui_file *stream, if (is_ref) { val = value_addr (val); - refcode = TYPE_CODE (type); + refcode = type->code (); } /* Pointer to class, check real type of object. */ @@ -581,7 +581,7 @@ c_value_print (struct value *val, struct ui_file *stream, if (!value_initialized (val)) fprintf_filtered (stream, " [uninitialized] "); - if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_STRUCT)) + if (options->objectprint && (type->code () == TYPE_CODE_STRUCT)) { /* Attempt to determine real type of object. */ real_type = value_rtti_type (val, &full, &top, &using_enc); diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index bec1b65..156f622 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -83,11 +83,11 @@ adjust_value_for_child_access (struct value **value, /* Pointers to structures are treated just like structures when accessing children. Don't dereference pointers to other types. */ - if (TYPE_CODE (*type) == TYPE_CODE_PTR) + if ((*type)->code () == TYPE_CODE_PTR) { struct type *target_type = get_target_type (*type); - if (TYPE_CODE (target_type) == TYPE_CODE_STRUCT - || TYPE_CODE (target_type) == TYPE_CODE_UNION) + if (target_type->code () == TYPE_CODE_STRUCT + || target_type->code () == TYPE_CODE_UNION) { if (value && *value) { @@ -142,8 +142,8 @@ c_is_path_expr_parent (const struct varobj *var) type = varobj_get_gdb_type (var); /* Anonymous unions and structs are also not path_expr parents. */ - if ((TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if ((type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) && TYPE_NAME (type) == NULL) { const struct varobj *parent = var->parent; @@ -159,8 +159,8 @@ c_is_path_expr_parent (const struct varobj *var) parent_type = varobj_get_value_type (parent); adjust_value_for_child_access (NULL, &parent_type, &was_ptr, 0); - if (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT - || TYPE_CODE (parent_type) == TYPE_CODE_UNION) + if (parent_type->code () == TYPE_CODE_STRUCT + || parent_type->code () == TYPE_CODE_UNION) { const char *field_name; @@ -188,7 +188,7 @@ c_number_of_children (const struct varobj *var) adjust_value_for_child_access (NULL, &type, NULL, 0); target = get_target_type (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0 @@ -214,8 +214,8 @@ c_number_of_children (const struct varobj *var) to test for it, please mind that a little magic is necessary to properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and TYPE_NAME == "char". */ - if (TYPE_CODE (target) == TYPE_CODE_FUNC - || TYPE_CODE (target) == TYPE_CODE_VOID) + if (target->code () == TYPE_CODE_FUNC + || target->code () == TYPE_CODE_VOID) children = 0; else children = 1; @@ -249,8 +249,8 @@ value_struct_element_index (struct value *value, int type_index) type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); try { @@ -302,7 +302,7 @@ c_describe_child (const struct varobj *parent, int index, } adjust_value_for_child_access (&value, &type, &was_ptr, 0); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: if (cname) @@ -348,7 +348,7 @@ c_describe_child (const struct varobj *parent, int index, { if (cname) { - if (TYPE_CODE (TYPE_FIELD_TYPE (type, index)) + if (TYPE_FIELD_TYPE (type, index)->code () == TYPE_CODE_STRUCT) *cname = ANONYMOUS_STRUCT_NAME; else @@ -486,7 +486,7 @@ c_value_of_variable (const struct varobj *var, while (TYPE_IS_REFERENCE (type)) type = check_typedef (TYPE_TARGET_TYPE (type)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -577,12 +577,12 @@ cplus_number_of_children (const struct varobj *var) { value = var->value.get (); lookup_actual_type = (TYPE_IS_REFERENCE (var->type) - || TYPE_CODE (var->type) == TYPE_CODE_PTR); + || var->type->code () == TYPE_CODE_PTR); } adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type); - if (((TYPE_CODE (type)) == TYPE_CODE_STRUCT) - || ((TYPE_CODE (type)) == TYPE_CODE_UNION)) + if (((type->code ()) == TYPE_CODE_STRUCT) + || ((type->code ()) == TYPE_CODE_UNION)) { int kids[3]; @@ -614,7 +614,7 @@ cplus_number_of_children (const struct varobj *var) value = parent->value.get (); lookup_actual_type = (TYPE_IS_REFERENCE (parent->type) - || TYPE_CODE (parent->type) == TYPE_CODE_PTR); + || parent->type->code () == TYPE_CODE_PTR); } adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type); @@ -719,7 +719,7 @@ cplus_describe_child (const struct varobj *parent, int index, var = (CPLUS_FAKE_CHILD (parent)) ? parent->parent : parent; if (opts.objectprint) lookup_actual_type = (TYPE_IS_REFERENCE (var->type) - || TYPE_CODE (var->type) == TYPE_CODE_PTR); + || var->type->code () == TYPE_CODE_PTR); value = var->value.get (); type = varobj_get_value_type (var); if (cfull_expression) @@ -728,8 +728,8 @@ cplus_describe_child (const struct varobj *parent, int index, adjust_value_for_child_access (&value, &type, &was_ptr, lookup_actual_type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) { const char *join = was_ptr ? "->" : "."; @@ -771,10 +771,10 @@ cplus_describe_child (const struct varobj *parent, int index, { if (cname) { - if (TYPE_CODE (TYPE_FIELD_TYPE (type, type_index)) + if (TYPE_FIELD_TYPE (type, type_index)->code () == TYPE_CODE_STRUCT) *cname = ANONYMOUS_STRUCT_NAME; - else if (TYPE_CODE (TYPE_FIELD_TYPE (type, type_index)) + else if (TYPE_FIELD_TYPE (type, type_index)->code () == TYPE_CODE_UNION) *cname = ANONYMOUS_UNION_NAME; } diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 104d273..58e9cf3 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1912,8 +1912,8 @@ setting_cmd (const char *fnname, struct cmd_list_element *showlist, struct type *type0 = check_typedef (value_type (argv[0])); - if (TYPE_CODE (type0) != TYPE_CODE_ARRAY - && TYPE_CODE (type0) != TYPE_CODE_STRING) + if (type0->code () != TYPE_CODE_ARRAY + && type0->code () != TYPE_CODE_STRING) error (_("First argument of %s must be a string."), fnname); const char *a0 = (const char *) value_contents (argv[0]); diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c index 7d152a9..710fd52 100644 --- a/gdb/cli/cli-utils.c +++ b/gdb/cli/cli-utils.c @@ -37,7 +37,7 @@ get_ulongest (const char **pp, int trailer) if (val != NULL) /* Value history reference */ { - if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT) + if (value_type (val)->code () == TYPE_CODE_INT) retval = value_as_long (val); else error (_("History value must have integer type.")); @@ -96,7 +96,7 @@ get_number_trailer (const char **pp, int trailer) if (val) /* Value history reference */ { - if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT) + if (value_type (val)->code () == TYPE_CODE_INT) retval = value_as_long (val); else { diff --git a/gdb/coffread.c b/gdb/coffread.c index 4b2993f..d320332 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1494,7 +1494,7 @@ patch_opaque_types (struct symtab *s) from different files with the same name. */ if (SYMBOL_CLASS (real_sym) == LOC_TYPEDEF && SYMBOL_DOMAIN (real_sym) == VAR_DOMAIN - && TYPE_CODE (SYMBOL_TYPE (real_sym)) == TYPE_CODE_PTR + && SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0) { const char *name = real_sym->linkage_name (); @@ -1660,8 +1660,8 @@ process_coff_symbol (struct coff_symbol *cs, /* If type has no name, give it one. */ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) { - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC) + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR + || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to foo" or "function returning foo", we @@ -1694,10 +1694,10 @@ process_coff_symbol (struct coff_symbol *cs, not an empty structured type, though; the forward references work themselves out via the magic of coff_lookup_type. */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) == 0 - && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) - != TYPE_CODE_UNDEF) + && TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))->code () + != TYPE_CODE_UNDEF) { int i = hashname (sym->linkage_name ()); diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c index b24a6c3..8499300 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -242,7 +242,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, maximally-aligned array of the correct size. */ fputs_unfiltered (" ", stream); - switch (TYPE_CODE (regtype)) + switch (regtype->code ()) { case TYPE_CODE_PTR: fprintf_filtered (stream, "__gdb_uintptr %s", diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index eb5af8e..ab9f442 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -99,7 +99,7 @@ convert_one_symbol (compile_c_instance *context, break; case LOC_CONST: - if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_ENUM) + if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM) { /* Already handled by convert_enum. */ return; @@ -497,7 +497,7 @@ generate_vla_size (compile_instance *compiler, if (TYPE_IS_REFERENCE (type)) type = check_typedef (TYPE_TARGET_TYPE (type)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: { diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 95bb537..ed4a6e9 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -94,11 +94,11 @@ convert_struct_or_union (compile_c_instance *context, struct type *type) /* First we create the resulting type and enter it into our hash table. This lets recursive types work. */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) result = context->plugin ().build_record_type (); else { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_UNION); result = context->plugin ().build_union_type (); } context->insert_type (type, result); @@ -282,7 +282,7 @@ convert_type_basic (compile_c_instance *context, struct type *type) | TYPE_INSTANCE_FLAG_RESTRICT)) != 0) return convert_qualified (context, type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: return convert_pointer (context, type); diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index fee2651..11a2d32 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -73,9 +73,9 @@ convert_one_symbol (compile_cplus_instance *instance, switch (SYMBOL_CLASS (sym.symbol)) { case LOC_TYPEDEF: - if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_TYPEDEF) + if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_TYPEDEF) kind = GCC_CP_SYMBOL_TYPEDEF; - else if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_NAMESPACE) + else if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_NAMESPACE) return; break; @@ -94,7 +94,7 @@ convert_one_symbol (compile_cplus_instance *instance, break; case LOC_CONST: - if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_ENUM) + if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM) { /* Already handled by convert_enum. */ return; diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index a179bd6..3dec3b2 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -88,7 +88,7 @@ get_field_access_flag (const struct type *type, int num) enum gcc_cp_symbol_kind get_method_access_flag (const struct type *type, int fni, int num) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT); + gdb_assert (type->code () == TYPE_CODE_STRUCT); /* If this type was not declared a class, everything is public. */ if (!TYPE_DECLARED_CLASS (type)) @@ -161,7 +161,7 @@ type_name_to_scope (const char *type_name, const struct block *block) scope.push_back (comp); - if (TYPE_CODE (SYMBOL_TYPE (bsymbol.symbol)) != TYPE_CODE_NAMESPACE) + if (SYMBOL_TYPE (bsymbol.symbol)->code () != TYPE_CODE_NAMESPACE) { /* We're done. */ break; @@ -271,7 +271,7 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope) (m_scopes.back ().begin (), m_scopes.back ().end () - 1, [this] (const scope_component &comp) { - gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol)) + gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code () == TYPE_CODE_NAMESPACE); const char *ns = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr @@ -313,7 +313,7 @@ compile_cplus_instance::leave_scope () std::for_each (current.begin (),current.end () - 1, [this] (const scope_component &comp) { - gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol)) + gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code () == TYPE_CODE_NAMESPACE); this->plugin ().pop_binding_level (comp.name.c_str ()); }); @@ -413,7 +413,7 @@ compile_cplus_convert_reference (compile_cplus_instance *instance, gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type)); enum gcc_cp_ref_qualifiers quals = GCC_CP_REF_QUAL_NONE; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_REF: quals = GCC_CP_REF_QUAL_LVALUE; @@ -826,7 +826,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance, table. This lets recursive types work. */ gcc_decl resuld; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { const char *what = TYPE_DECLARED_CLASS (type) ? "struct" : "class"; @@ -839,14 +839,14 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance, } else { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_UNION); resuld = instance->plugin ().build_decl ("union", name.get (), GCC_CP_SYMBOL_UNION | nested_access, 0, nullptr, 0, filename, line); } gcc_type result; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { struct gcc_vbase_array bases; int num_baseclasses = TYPE_N_BASECLASSES (type); @@ -878,7 +878,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance, } else { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_UNION); result = instance->plugin ().start_class_type (name.get (), resuld, nullptr, filename, line); } @@ -1140,7 +1140,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance, | TYPE_INSTANCE_FLAG_RESTRICT)) != 0) return compile_cplus_convert_qualified (instance, type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_REF: case TYPE_CODE_RVALUE_REF: @@ -1198,7 +1198,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance, } std::string s = string_printf (_("unhandled TYPE_CODE %d"), - TYPE_CODE (type)); + type->code ()); return instance->plugin ().error (s.c_str ()); } diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index be4fa76..55a46a3 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -452,7 +452,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE); gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym); gdb_ptr_type = check_typedef (gdb_ptr_type); - if (TYPE_CODE (gdb_ptr_type) != TYPE_CODE_PTR) + if (gdb_ptr_type->code () != TYPE_CODE_PTR) error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE); gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type)); @@ -464,14 +464,14 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, return gdb_type; } - if (TYPE_CODE (gdb_type) != TYPE_CODE_PTR) + if (gdb_type->code () != TYPE_CODE_PTR) error (_("Invalid type code %d of symbol \"%s\" " "in compiled module \"%s\"."), - TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_VAL, + gdb_type_from_ptr->code (), COMPILE_I_EXPR_VAL, objfile_name (objfile)); retval = gdb_type_from_ptr; - switch (TYPE_CODE (gdb_type_from_ptr)) + switch (gdb_type_from_ptr->code ()) { case TYPE_CODE_ARRAY: gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr); @@ -481,7 +481,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, default: error (_("Invalid type code %d of symbol \"%s\" " "in compiled module \"%s\"."), - TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_PTR_TYPE, + gdb_type_from_ptr->code (), COMPILE_I_EXPR_PTR_TYPE, objfile_name (objfile)); } if (!types_deeply_equal (gdb_type_from_ptr, @@ -509,17 +509,17 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile) return NULL; regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0)); - if (TYPE_CODE (regsp_type) != TYPE_CODE_PTR) + if (regsp_type->code () != TYPE_CODE_PTR) error (_("Invalid type code %d of first parameter of function \"%s\" " "in compiled module \"%s\"."), - TYPE_CODE (regsp_type), GCC_FE_WRAPPER_FUNCTION, + regsp_type->code (), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type)); - if (TYPE_CODE (regs_type) != TYPE_CODE_STRUCT) + if (regs_type->code () != TYPE_CODE_STRUCT) error (_("Invalid type code %d of dereferenced first parameter " "of function \"%s\" in compiled module \"%s\"."), - TYPE_CODE (regs_type), GCC_FE_WRAPPER_FUNCTION, + regs_type->code (), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); return regs_type; @@ -555,10 +555,10 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base) reg_name, pulongest (reg_bitpos), pulongest (reg_bitsize)); reg_offset = reg_bitpos / 8; - if (TYPE_CODE (reg_type) != TYPE_CODE_INT - && TYPE_CODE (reg_type) != TYPE_CODE_PTR) + if (reg_type->code () != TYPE_CODE_INT + && reg_type->code () != TYPE_CODE_PTR) error (_("Invalid register \"%s\" type code %d"), reg_name, - TYPE_CODE (reg_type)); + reg_type->code ()); regnum = compile_register_name_demangle (gdbarch, reg_name); @@ -646,10 +646,10 @@ compile_object_load (const compile_file_names &file_names, error (_("Cannot find function \"%s\" in compiled module \"%s\"."), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); func_type = SYMBOL_TYPE (func_sym); - if (TYPE_CODE (func_type) != TYPE_CODE_FUNC) + if (func_type->code () != TYPE_CODE_FUNC) error (_("Invalid type code %d of function \"%s\" in compiled " "module \"%s\"."), - TYPE_CODE (func_type), GCC_FE_WRAPPER_FUNCTION, + func_type->code (), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); switch (scope) diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c index 9cef786..cef1d06 100644 --- a/gdb/compile/compile-object-run.c +++ b/gdb/compile/compile-object-run.c @@ -149,7 +149,7 @@ compile_object_run (struct compile_module *module) func_type = copy_type_recursive (objfile, func_type, copied_types); htab_delete (copied_types); - gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC); + gdb_assert (func_type->code () == TYPE_CODE_FUNC); func_val = value_from_pointer (lookup_pointer_type (func_type), BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func_sym))); diff --git a/gdb/completer.c b/gdb/completer.c index f9631f4..71e31cf 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -1103,7 +1103,7 @@ add_struct_fields (struct type *type, completion_list &output, fieldname, namelen)) output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i))); } - else if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION) + else if (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION) { /* Recurse into anonymous unions. */ add_struct_fields (TYPE_FIELD_TYPE (type, i), @@ -1156,13 +1156,13 @@ complete_expression (completion_tracker &tracker, for (;;) { type = check_typedef (type); - if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) break; type = TYPE_TARGET_TYPE (type); } - if (TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_STRUCT) { completion_list result; diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 3a2100d..517a071 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -278,8 +278,8 @@ cp_search_static_and_baseclasses (const char *name, /* If the scope is a function/method, then look up NESTED as a local static variable. E.g., "print 'function()::static_var'". */ - if ((TYPE_CODE (scope_type) == TYPE_CODE_FUNC - || TYPE_CODE (scope_type) == TYPE_CODE_METHOD) + if ((scope_type->code () == TYPE_CODE_FUNC + || scope_type->code () == TYPE_CODE_METHOD) && domain == VAR_DOMAIN) return lookup_symbol (nested, SYMBOL_BLOCK_VALUE (scope_sym.symbol), VAR_DOMAIN, NULL); @@ -927,7 +927,7 @@ cp_lookup_nested_symbol (struct type *parent_type, domain_name (domain)); } - switch (TYPE_CODE (parent_type)) + switch (parent_type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_NAMESPACE: diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 92a2e3b..bc9e8d4 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -183,8 +183,8 @@ inspect_type (struct demangle_parse_info *info, } /* If the type is a typedef or namespace alias, replace it. */ - if (TYPE_CODE (otype) == TYPE_CODE_TYPEDEF - || TYPE_CODE (otype) == TYPE_CODE_NAMESPACE) + if (otype->code () == TYPE_CODE_TYPEDEF + || otype->code () == TYPE_CODE_NAMESPACE) { long len; int is_anon; @@ -212,16 +212,16 @@ inspect_type (struct demangle_parse_info *info, return 0; is_anon = (TYPE_NAME (type) == NULL - && (TYPE_CODE (type) == TYPE_CODE_ENUM - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION)); + && (type->code () == TYPE_CODE_ENUM + || type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION)); if (is_anon) { struct type *last = otype; /* Find the last typedef for the type. */ while (TYPE_TARGET_TYPE (last) != NULL - && (TYPE_CODE (TYPE_TARGET_TYPE (last)) + && (TYPE_TARGET_TYPE (last)->code () == TYPE_CODE_TYPEDEF)) last = TYPE_TARGET_TYPE (last); @@ -1267,13 +1267,13 @@ add_symbol_overload_list_adl_namespace (struct type *type, const char *type_name; int i, prefix_len; - while (TYPE_CODE (type) == TYPE_CODE_PTR + while (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) - || TYPE_CODE (type) == TYPE_CODE_ARRAY - || TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + || type->code () == TYPE_CODE_ARRAY + || type->code () == TYPE_CODE_TYPEDEF) { - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) - type = check_typedef(type); + if (type->code () == TYPE_CODE_TYPEDEF) + type = check_typedef (type); else type = TYPE_TARGET_TYPE (type); } @@ -1296,7 +1296,7 @@ add_symbol_overload_list_adl_namespace (struct type *type, } /* Check public base type */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) for (i = 0; i < TYPE_N_BASECLASSES (type); i++) { if (BASETYPE_VIA_PUBLIC (type, i)) @@ -1450,7 +1450,7 @@ cp_lookup_rtti_type (const char *name, const struct block *block) rtti_type = check_typedef (SYMBOL_TYPE (rtti_sym)); - switch (TYPE_CODE (rtti_type)) + switch (rtti_type->code ()) { case TYPE_CODE_STRUCT: break; diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 5625a58..799bdb1 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -74,25 +74,25 @@ cp_is_vtbl_member (struct type *type) { /* With older versions of g++, the vtbl field pointed to an array of structures. Nowadays it points directly to the structure. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* if not using thunks */ - || TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */ + if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */ + || type->code () == TYPE_CODE_PTR) /* if using thunks */ { /* Virtual functions tables are full of pointers to virtual functions. */ return cp_is_vtbl_ptr_type (type); } } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) /* if not using thunks */ + else if (type->code () == TYPE_CODE_STRUCT) /* if not using thunks */ { return cp_is_vtbl_ptr_type (type); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */ + else if (type->code () == TYPE_CODE_PTR) /* if using thunks */ { /* The type name of the thunk pointer is NULL when using dwarf2. We could test for a pointer to a function, but @@ -563,7 +563,7 @@ cp_print_static_field (struct type *type, } struct type *real_type = check_typedef (type); - if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT) + if (real_type->code () == TYPE_CODE_STRUCT) { CORE_ADDR *first_dont_print; CORE_ADDR addr = value_address (val); @@ -591,7 +591,7 @@ cp_print_static_field (struct type *type, return; } - if (TYPE_CODE (real_type) == TYPE_CODE_ARRAY) + if (real_type->code () == TYPE_CODE_ARRAY) { struct type **first_dont_print; int i; diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index e619811..068ae99 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1805,8 +1805,8 @@ cris_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION || TYPE_LENGTH (type) > 8) /* Structs, unions, and anything larger than 8 bytes (2 registers) goes on the stack. */ diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 06c036d..1efa47b 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -460,7 +460,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; break; case CTF_K_CONST: - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID) + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID) SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int; break; case CTF_K_TYPEDEF: @@ -726,7 +726,7 @@ add_array_cv_type (struct ctf_context *ccp, base_type = copy_type (base_type); inner_array = base_type; - while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY) + while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) { TYPE_TARGET_TYPE (inner_array) = copy_type (TYPE_TARGET_TYPE (inner_array)); diff --git a/gdb/d-exp.y b/gdb/d-exp.y index fa525d3..fdd68a5 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -462,7 +462,7 @@ PrimaryExpression: /* Check if the qualified name is in the global context. However if the symbol has not already been resolved, it's not likely to be found. */ - if (TYPE_CODE (type) == TYPE_CODE_MODULE) + if (type->code () == TYPE_CODE_MODULE) { struct bound_minimal_symbol msymbol; struct block_symbol sym; @@ -644,10 +644,10 @@ BasicType: static int type_aggregate_p (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_MODULE - || (TYPE_CODE (type) == TYPE_CODE_ENUM + return (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_MODULE + || (type->code () == TYPE_CODE_ENUM && TYPE_DECLARED_CLASS (type))); } diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c index de27ab7..f15708b 100644 --- a/gdb/d-namespace.c +++ b/gdb/d-namespace.c @@ -308,7 +308,7 @@ d_lookup_nested_symbol (struct type *parent_type, parent_type = check_typedef (parent_type); - switch (TYPE_CODE (parent_type)) + switch (parent_type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c index 109049c..cb0f509 100644 --- a/gdb/d-valprint.c +++ b/gdb/d-valprint.c @@ -35,7 +35,7 @@ dynamic_array_type (struct type *type, const struct value_print_options *options) { if (TYPE_NFIELDS (type) == 2 - && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_INT + && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_INT && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0 && strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0 && !value_bits_any_optimized_out (val, @@ -78,7 +78,7 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse, int ret; struct type *type = check_typedef (value_type (val)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: ret = dynamic_array_type (type, value_embedded_offset (val), diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 243f493..14ffae4 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -146,9 +146,9 @@ dwarf_expr_context::fetch (int n) static void dwarf_require_integral (struct type *type) { - if (TYPE_CODE (type) != TYPE_CODE_INT - && TYPE_CODE (type) != TYPE_CODE_CHAR - && TYPE_CODE (type) != TYPE_CODE_BOOL) + if (type->code () != TYPE_CODE_INT + && type->code () != TYPE_CODE_CHAR + && type->code () != TYPE_CODE_BOOL) error (_("integral type expected in DWARF expression")); } @@ -363,7 +363,7 @@ dwarf_expr_require_composition (const gdb_byte *op_ptr, const gdb_byte *op_end, static int base_types_equal_p (struct type *t1, struct type *t2) { - if (TYPE_CODE (t1) != TYPE_CODE (t2)) + if (t1->code () != t2->code ()) return 0; if (TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2)) return 0; diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 5b690ca..616fce9 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -605,8 +605,8 @@ sect_variable_value (struct dwarf_expr_context *ctx, sect_offset sect_off, /* Note: Things still work when the following test is removed. This test and error is here to conform to the proposed specification. */ - if (TYPE_CODE (die_type) != TYPE_CODE_INT - && TYPE_CODE (die_type) != TYPE_CODE_PTR) + if (die_type->code () != TYPE_CODE_INT + && die_type->code () != TYPE_CODE_PTR) error (_("Type of DW_OP_GNU_variable_value DIE must be an integer or pointer.")); struct type *type = lookup_pointer_type (die_type); @@ -915,7 +915,7 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr) paddress (gdbarch, addr)); type = SYMBOL_TYPE (sym); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FUNC); + gdb_assert (type->code () == TYPE_CODE_FUNC); gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC); return sym; @@ -2027,7 +2027,7 @@ indirect_pieced_value (struct value *value) enum bfd_endian byte_order; type = check_typedef (value_type (value)); - if (TYPE_CODE (type) != TYPE_CODE_PTR) + if (type->code () != TYPE_CODE_PTR) return NULL; bit_length = 8 * TYPE_LENGTH (type); @@ -2289,7 +2289,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, the operation. Therefore, we do the conversion here since the type is readily available. */ - switch (TYPE_CODE (subobj_type)) + switch (subobj_type->code ()) { case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4809202..ab21ab0 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9285,7 +9285,7 @@ alloc_rust_variant (struct obstack *obstack, struct type *type, static void quirk_rust_enum (struct type *type, struct objfile *objfile) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_UNION); /* We don't need to deal with empty enums. */ if (TYPE_NFIELDS (type) == 0) @@ -9385,7 +9385,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) { disr_type = TYPE_FIELD_TYPE (type, i); - if (TYPE_CODE (disr_type) != TYPE_CODE_STRUCT) + if (disr_type->code () != TYPE_CODE_STRUCT) { /* All fields of a true enum will be structs. */ return; @@ -10299,7 +10299,7 @@ dwarf2_compute_name (const char *name, the two cases. */ if (TYPE_NFIELDS (type) > 0 && TYPE_FIELD_ARTIFICIAL (type, 0) - && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_PTR + && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)))) buf.puts (" const"); @@ -10483,7 +10483,7 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu) sect_offset sect_off = attr->get_ref_die_offset (); type = get_die_type_at_offset (sect_off, cu->per_cu); - if (type != NULL && TYPE_CODE (type) == TYPE_CODE_NAMESPACE) + if (type != NULL && type->code () == TYPE_CODE_NAMESPACE) { /* This declaration is a global namespace alias. Add a symbol for it whose type is the aliased namespace. */ @@ -13308,7 +13308,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) func_type = get_die_type (func_die, cu); if (func_type != NULL) { - gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC); + gdb_assert (func_type->code () == TYPE_CODE_FUNC); /* Enlist this call site to the function. */ call_site->tail_call_next = TYPE_TAIL_CALL_LIST (func_type); @@ -14959,7 +14959,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, fnp->type = alloc_type (objfile); this_type = read_type_die (die, cu); - if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC) + if (this_type && this_type->code () == TYPE_CODE_FUNC) { int nparams = TYPE_NFIELDS (this_type); @@ -15157,7 +15157,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile) struct type *pfn_type, *self_type, *new_type; /* Check for a structure with no name and two children. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2) + if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2) return; /* Check for __pfn and __delta members. */ @@ -15170,15 +15170,15 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile) /* Find the type of the method. */ pfn_type = TYPE_FIELD_TYPE (type, 0); if (pfn_type == NULL - || TYPE_CODE (pfn_type) != TYPE_CODE_PTR - || TYPE_CODE (TYPE_TARGET_TYPE (pfn_type)) != TYPE_CODE_FUNC) + || pfn_type->code () != TYPE_CODE_PTR + || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC) return; /* Look for the "this" argument. */ pfn_type = TYPE_TARGET_TYPE (pfn_type); if (TYPE_NFIELDS (pfn_type) == 0 /* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */ - || TYPE_CODE (TYPE_FIELD_TYPE (pfn_type, 0)) != TYPE_CODE_PTR) + || TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR) return; self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0)); @@ -16679,9 +16679,9 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu) if (type) return type; - if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_METHOD) + if (check_typedef (to_type)->code () == TYPE_CODE_METHOD) type = lookup_methodptr_type (to_type); - else if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_FUNC) + else if (check_typedef (to_type)->code () == TYPE_CODE_FUNC) { struct type *new_type = alloc_type (cu->per_cu->dwarf2_per_objfile->objfile); @@ -16746,7 +16746,7 @@ add_array_cv_type (struct die_info *die, struct dwarf2_cu *cu, base_type = copy_type (base_type); inner_array = base_type; - while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY) + while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) { TYPE_TARGET_TYPE (inner_array) = copy_type (TYPE_TARGET_TYPE (inner_array)); @@ -16775,7 +16775,7 @@ read_tag_const_type (struct die_info *die, struct dwarf2_cu *cu) /* In case the const qualifier is applied to an array type, the element type is so qualified, not the array type (section 6.7.3 of C99). */ - if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY) + if (base_type->code () == TYPE_CODE_ARRAY) return add_array_cv_type (die, cu, base_type, 1, 0); cv_type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0); @@ -16797,7 +16797,7 @@ read_tag_volatile_type (struct die_info *die, struct dwarf2_cu *cu) /* In case the volatile qualifier is applied to an array type, the element type is so qualified, not the array type (section 6.7.3 of C99). */ - if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY) + if (base_type->code () == TYPE_CODE_ARRAY) return add_array_cv_type (die, cu, base_type, 0, 1); cv_type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0); @@ -17323,7 +17323,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) case DW_ATE_complex_float: type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name, byte_order); - if (TYPE_CODE (type) == TYPE_CODE_ERROR) + if (type->code () == TYPE_CODE_ERROR) { if (name == nullptr) { @@ -17578,7 +17578,7 @@ read_subrange_index_type (struct die_info *die, struct dwarf2_cu *cu) GCC produces an empty range DIE. FIXME: muller/2010-05-28: Possible references to object for low bound, high bound or count are not yet handled by this code. */ - if (TYPE_CODE (index_type) == TYPE_CODE_VOID) + if (index_type->code () == TYPE_CODE_VOID) index_type = cu->per_cu->addr_sized_int_type (false); return index_type; @@ -20717,7 +20717,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* Compilation with minimal debug info may result in variables with missing type entries. Change the misleading `void' type to something sensible. */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID) + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID) SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int; attr = dwarf2_attr (die, DW_AT_const_value, cu); @@ -23639,11 +23639,11 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) But this is not a problem, because the gnat-specific information is actually not needed for these types. */ if (need_gnat_info (cu) - && TYPE_CODE (type) != TYPE_CODE_FUNC - && TYPE_CODE (type) != TYPE_CODE_FLT - && TYPE_CODE (type) != TYPE_CODE_METHODPTR - && TYPE_CODE (type) != TYPE_CODE_MEMBERPTR - && TYPE_CODE (type) != TYPE_CODE_METHOD + && type->code () != TYPE_CODE_FUNC + && type->code () != TYPE_CODE_FLT + && type->code () != TYPE_CODE_METHODPTR + && type->code () != TYPE_CODE_MEMBERPTR + && type->code () != TYPE_CODE_METHOD && !HAVE_GNAT_AUX_INFO (type)) INIT_GNAT_SPECIFIC (type); @@ -302,7 +302,7 @@ evaluate_struct_tuple (struct value *struct_val, if (fieldno >= TYPE_NFIELDS (struct_type)) error (_("too many initializers")); field_type = TYPE_FIELD_TYPE (struct_type, fieldno); - if (TYPE_CODE (field_type) == TYPE_CODE_UNION + if (field_type->code () == TYPE_CODE_UNION && TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0') error (_("don't know which variant you want to set")); @@ -450,21 +450,21 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, type1 = check_typedef (value_type (*arg1)); type2 = check_typedef (value_type (*arg2)); - if ((TYPE_CODE (type1) != TYPE_CODE_FLT - && TYPE_CODE (type1) != TYPE_CODE_DECFLOAT + if ((type1->code () != TYPE_CODE_FLT + && type1->code () != TYPE_CODE_DECFLOAT && !is_integral_type (type1)) - || (TYPE_CODE (type2) != TYPE_CODE_FLT - && TYPE_CODE (type2) != TYPE_CODE_DECFLOAT + || (type2->code () != TYPE_CODE_FLT + && type2->code () != TYPE_CODE_DECFLOAT && !is_integral_type (type2))) return; - if (TYPE_CODE (type1) == TYPE_CODE_DECFLOAT - || TYPE_CODE (type2) == TYPE_CODE_DECFLOAT) + if (type1->code () == TYPE_CODE_DECFLOAT + || type2->code () == TYPE_CODE_DECFLOAT) { /* No promotion required. */ } - else if (TYPE_CODE (type1) == TYPE_CODE_FLT - || TYPE_CODE (type2) == TYPE_CODE_FLT) + else if (type1->code () == TYPE_CODE_FLT + || type2->code () == TYPE_CODE_FLT) { switch (language->la_language) { @@ -489,8 +489,8 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, break; } } - else if (TYPE_CODE (type1) == TYPE_CODE_BOOL - && TYPE_CODE (type2) == TYPE_CODE_BOOL) + else if (type1->code () == TYPE_CODE_BOOL + && type2->code () == TYPE_CODE_BOOL) { /* No promotion required. */ } @@ -616,7 +616,7 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type) if (TYPE_IS_REFERENCE (type)) type = TYPE_TARGET_TYPE (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_FUNC: @@ -668,7 +668,7 @@ fake_method::fake_method (type_instance_flags flags, --num_types; TYPE_VARARGS (type) = 1; } - else if (TYPE_CODE (check_typedef (param_types[num_types - 1])) + else if (check_typedef (param_types[num_types - 1])->code () == TYPE_CODE_VOID) { --num_types; @@ -772,7 +772,7 @@ eval_call (expression *exp, enum noside noside, type *ftype = value_type (argvec[0]); - if (TYPE_CODE (ftype) == TYPE_CODE_INTERNAL_FUNCTION) + if (ftype->code () == TYPE_CODE_INTERNAL_FUNCTION) { /* We don't know anything about what the internal function might return, but we have to return @@ -780,7 +780,7 @@ eval_call (expression *exp, enum noside noside, return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); } - else if (TYPE_CODE (ftype) == TYPE_CODE_XMETHOD) + else if (ftype->code () == TYPE_CODE_XMETHOD) { type *return_type = result_type_of_xmethod (argvec[0], @@ -791,8 +791,8 @@ eval_call (expression *exp, enum noside noside, error (_("Xmethod is missing return type.")); return value_zero (return_type, not_lval); } - else if (TYPE_CODE (ftype) == TYPE_CODE_FUNC - || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + else if (ftype->code () == TYPE_CODE_FUNC + || ftype->code () == TYPE_CODE_METHOD) { if (TYPE_GNU_IFUNC (ftype)) { @@ -817,7 +817,7 @@ eval_call (expression *exp, enum noside noside, error (_("Expression of type other than " "\"Function returning ...\" used as function")); } - switch (TYPE_CODE (value_type (argvec[0]))) + switch (value_type (argvec[0])->code ()) { case TYPE_CODE_INTERNAL_FUNCTION: return call_internal_function (exp->gdbarch, exp->language_defn, @@ -879,7 +879,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, if (noside == EVAL_SKIP) tem = 1; /* Set it to the right arg index so that all arguments can also be skipped. */ - else if (TYPE_CODE (a1_type) == TYPE_CODE_METHODPTR) + else if (a1_type->code () == TYPE_CODE_METHODPTR) { if (noside == EVAL_AVOID_SIDE_EFFECTS) arg1 = value_zero (TYPE_TARGET_TYPE (a1_type), not_lval); @@ -891,7 +891,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, tem = 2; argvec[1] = arg2; } - else if (TYPE_CODE (a1_type) == TYPE_CODE_MEMBERPTR) + else if (a1_type->code () == TYPE_CODE_MEMBERPTR) { struct type *type_ptr = lookup_pointer_type (TYPE_SELF_TYPE (a1_type)); @@ -987,7 +987,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, function = NULL; function_name = NULL; - if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE) + if (type->code () == TYPE_CODE_NAMESPACE) { function = cp_lookup_symbol_namespace (TYPE_NAME (type), name, @@ -1002,8 +1002,8 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, } else { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); function_name = name; /* We need a properly typed value for method lookup. For @@ -1054,9 +1054,9 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside); type *type = value_type (argvec[0]); - if (type && TYPE_CODE (type) == TYPE_CODE_PTR) + if (type && type->code () == TYPE_CODE_PTR) type = TYPE_TARGET_TYPE (type); - if (type && TYPE_CODE (type) == TYPE_CODE_FUNC) + if (type && type->code () == TYPE_CODE_FUNC) { for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++) { @@ -1313,7 +1313,7 @@ evaluate_subexp_standard (struct type *expect_type, { (*pos) += 3; symbol *var = exp->elts[pc + 2].symbol; - if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_ERROR) + if (SYMBOL_TYPE (var)->code () == TYPE_CODE_ERROR) error_unknown_type (var->print_name ()); if (noside != EVAL_SKIP) return evaluate_var_value (noside, exp->elts[pc + 1].block, var); @@ -1335,7 +1335,7 @@ evaluate_subexp_standard (struct type *expect_type, msymbol); type = value_type (val); - if (TYPE_CODE (type) == TYPE_CODE_ERROR + if (type->code () == TYPE_CODE_ERROR && (noside != EVAL_AVOID_SIDE_EFFECTS || pc != 0)) error_unknown_type (msymbol->print_name ()); return val; @@ -1449,7 +1449,7 @@ evaluate_subexp_standard (struct type *expect_type, type = expect_type ? check_typedef (expect_type) : NULL_TYPE; if (expect_type != NULL_TYPE && noside != EVAL_SKIP - && TYPE_CODE (type) == TYPE_CODE_STRUCT) + && type->code () == TYPE_CODE_STRUCT) { struct value *rec = allocate_value (expect_type); @@ -1458,7 +1458,7 @@ evaluate_subexp_standard (struct type *expect_type, } if (expect_type != NULL_TYPE && noside != EVAL_SKIP - && TYPE_CODE (type) == TYPE_CODE_ARRAY) + && type->code () == TYPE_CODE_ARRAY) { struct type *range_type = TYPE_INDEX_TYPE (type); struct type *element_type = TYPE_TARGET_TYPE (type); @@ -1506,7 +1506,7 @@ evaluate_subexp_standard (struct type *expect_type, } if (expect_type != NULL_TYPE && noside != EVAL_SKIP - && TYPE_CODE (type) == TYPE_CODE_SET) + && type->code () == TYPE_CODE_SET) { struct value *set = allocate_value (expect_type); gdb_byte *valaddr = value_contents_raw (set); @@ -1515,8 +1515,8 @@ evaluate_subexp_standard (struct type *expect_type, LONGEST low_bound, high_bound; /* Get targettype of elementtype. */ - while (TYPE_CODE (check_type) == TYPE_CODE_RANGE - || TYPE_CODE (check_type) == TYPE_CODE_TYPEDEF) + while (check_type->code () == TYPE_CODE_RANGE + || check_type->code () == TYPE_CODE_TYPEDEF) check_type = TYPE_TARGET_TYPE (check_type); if (get_discrete_bounds (element_type, &low_bound, &high_bound) < 0) @@ -1535,17 +1535,17 @@ evaluate_subexp_standard (struct type *expect_type, /* Check types of elements to avoid mixture of elements from different types. Also check if type of element is "compatible" with element type of powerset. */ - if (TYPE_CODE (range_low_type) == TYPE_CODE_RANGE) + if (range_low_type->code () == TYPE_CODE_RANGE) range_low_type = TYPE_TARGET_TYPE (range_low_type); - if (TYPE_CODE (range_high_type) == TYPE_CODE_RANGE) + if (range_high_type->code () == TYPE_CODE_RANGE) range_high_type = TYPE_TARGET_TYPE (range_high_type); - if ((TYPE_CODE (range_low_type) != TYPE_CODE (range_high_type)) - || (TYPE_CODE (range_low_type) == TYPE_CODE_ENUM + if ((range_low_type->code () != range_high_type->code ()) + || (range_low_type->code () == TYPE_CODE_ENUM && (range_low_type != range_high_type))) /* different element modes. */ error (_("POWERSET tuple elements of different mode")); - if ((TYPE_CODE (check_type) != TYPE_CODE (range_low_type)) - || (TYPE_CODE (check_type) == TYPE_CODE_ENUM + if ((check_type->code () != range_low_type->code ()) + || (check_type->code () == TYPE_CODE_ENUM && range_low_type != check_type)) error (_("incompatible POWERSET tuple elements")); if (range_low > range_high) @@ -1799,9 +1799,9 @@ evaluate_subexp_standard (struct type *expect_type, block_for_pc (funaddr); val_type = check_typedef (val_type); - - if ((val_type == NULL) - || (TYPE_CODE(val_type) == TYPE_CODE_ERROR)) + + if ((val_type == NULL) + || (val_type->code () == TYPE_CODE_ERROR)) { if (expect_type != NULL) val_type = expect_type; @@ -1815,7 +1815,7 @@ evaluate_subexp_standard (struct type *expect_type, struct_return = using_struct_return (exp->gdbarch, NULL, check_typedef (expect_type)); } - + /* Found a function symbol. Now we will substitute its value in place of the message dispatcher (obj_msgSend), so that we call the method directly instead of thru @@ -1831,7 +1831,7 @@ evaluate_subexp_standard (struct type *expect_type, if (method) { - if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC) + if (value_type (method)->code () != TYPE_CODE_FUNC) error (_("method address has symbol information " "with non-function type; skipping")); @@ -1873,13 +1873,13 @@ evaluate_subexp_standard (struct type *expect_type, struct type *callee_type = value_type (called_method); - if (callee_type && TYPE_CODE (callee_type) == TYPE_CODE_PTR) + if (callee_type && callee_type->code () == TYPE_CODE_PTR) callee_type = TYPE_TARGET_TYPE (callee_type); callee_type = TYPE_TARGET_TYPE (callee_type); if (callee_type) { - if ((TYPE_CODE (callee_type) == TYPE_CODE_ERROR) && expect_type) + if ((callee_type->code () == TYPE_CODE_ERROR) && expect_type) return allocate_value (expect_type); else return allocate_value (callee_type); @@ -1933,7 +1933,7 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); type = check_typedef (value_type (arg1)); - code = TYPE_CODE (type); + code = type->code (); if (code == TYPE_CODE_PTR) { @@ -1943,13 +1943,13 @@ evaluate_subexp_standard (struct type *expect_type, to the target value the original one points to. */ struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); - if (TYPE_CODE (target_type) == TYPE_CODE_ARRAY - || TYPE_CODE (target_type) == TYPE_CODE_STRING - || TYPE_CODE (target_type) == TYPE_CODE_FUNC) + if (target_type->code () == TYPE_CODE_ARRAY + || target_type->code () == TYPE_CODE_STRING + || target_type->code () == TYPE_CODE_FUNC) { arg1 = value_ind (arg1); type = check_typedef (value_type (arg1)); - code = TYPE_CODE (type); + code = type->code (); } } @@ -2082,7 +2082,7 @@ evaluate_subexp_standard (struct type *expect_type, get_user_print_options (&opts); if (opts.objectprint && TYPE_TARGET_TYPE (arg_type) - && (TYPE_CODE (TYPE_TARGET_TYPE (arg_type)) == TYPE_CODE_STRUCT)) + && (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT)) { real_type = value_rtti_indirect_type (arg1, &full, &top, &using_enc); @@ -2110,7 +2110,7 @@ evaluate_subexp_standard (struct type *expect_type, return eval_skip_value (exp); type = check_typedef (value_type (arg2)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_METHODPTR: if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -2118,7 +2118,7 @@ evaluate_subexp_standard (struct type *expect_type, else { arg2 = cplus_method_ptr_to_value (&arg1, arg2); - gdb_assert (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR); + gdb_assert (value_type (arg2)->code () == TYPE_CODE_PTR); return value_ind (arg2); } @@ -2324,8 +2324,8 @@ evaluate_subexp_standard (struct type *expect_type, arg1 = coerce_ref (arg1); type = check_typedef (value_type (arg1)); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_PTR) + if (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_PTR) { if (TYPE_NAME (type)) error (_("cannot subscript something of type `%s'"), @@ -2383,7 +2383,7 @@ evaluate_subexp_standard (struct type *expect_type, arg1 = coerce_ref (arg1); type = check_typedef (value_type (arg1)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_ARRAY: @@ -2607,8 +2607,8 @@ evaluate_subexp_standard (struct type *expect_type, if (noside == EVAL_SKIP) return eval_skip_value (exp); type = check_typedef (value_type (arg2)); - if (TYPE_CODE (type) != TYPE_CODE_INT - && TYPE_CODE (type) != TYPE_CODE_ENUM) + if (type->code () != TYPE_CODE_INT + && type->code () != TYPE_CODE_ENUM) error (_("Non-integral right operand for \"@\" operator.")); if (noside == EVAL_AVOID_SIDE_EFFECTS) { @@ -2673,12 +2673,12 @@ evaluate_subexp_standard (struct type *expect_type, } case UNOP_IND: - if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) + if (expect_type && expect_type->code () == TYPE_CODE_PTR) expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); arg1 = evaluate_subexp (expect_type, exp, pos, noside); type = check_typedef (value_type (arg1)); - if (TYPE_CODE (type) == TYPE_CODE_METHODPTR - || TYPE_CODE (type) == TYPE_CODE_MEMBERPTR) + if (type->code () == TYPE_CODE_METHODPTR + || type->code () == TYPE_CODE_MEMBERPTR) error (_("Attempt to dereference pointer " "to member without an object")); if (noside == EVAL_SKIP) @@ -2688,14 +2688,14 @@ evaluate_subexp_standard (struct type *expect_type, else if (noside == EVAL_AVOID_SIDE_EFFECTS) { type = check_typedef (value_type (arg1)); - if (TYPE_CODE (type) == TYPE_CODE_PTR + if (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) /* In C you can dereference an array to get the 1st elt. */ - || TYPE_CODE (type) == TYPE_CODE_ARRAY + || type->code () == TYPE_CODE_ARRAY ) return value_zero (TYPE_TARGET_TYPE (type), lval_memory); - else if (TYPE_CODE (type) == TYPE_CODE_INT) + else if (type->code () == TYPE_CODE_INT) /* GDB allows dereferencing an int. */ return value_zero (builtin_type (exp->gdbarch)->builtin_int, lval_memory); @@ -2707,7 +2707,7 @@ evaluate_subexp_standard (struct type *expect_type, This returns an int, which seems like the most C-like thing to do. "long long" variables are rare enough that BUILTIN_TYPE_LONGEST would seem to be a mistake. */ - if (TYPE_CODE (type) == TYPE_CODE_INT) + if (type->code () == TYPE_CODE_INT) return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, (CORE_ADDR) value_as_address (arg1)); return value_ind (arg1); @@ -3140,7 +3140,7 @@ evaluate_subexp_with_coercion (struct expression *exp, case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; type = check_typedef (SYMBOL_TYPE (var)); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (type) && CAST_IS_CONVERSION (exp->language_defn)) { @@ -3186,9 +3186,9 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos, (*pos)++; val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); type = check_typedef (value_type (val)); - if (TYPE_CODE (type) != TYPE_CODE_PTR + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type) - && TYPE_CODE (type) != TYPE_CODE_ARRAY) + && type->code () != TYPE_CODE_ARRAY) error (_("Attempt to take contents of a non-pointer value.")); type = TYPE_TARGET_TYPE (type); if (is_dynamic_type (type)) @@ -3212,7 +3212,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos, { val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL); type = value_type (val); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && is_dynamic_type (TYPE_INDEX_TYPE (type)) && TYPE_HIGH_BOUND_UNDEFINED (TYPE_INDEX_TYPE (type))) return allocate_optimized_out_value (size_type); @@ -3231,7 +3231,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos, msymbol); type = value_type (mval); - if (TYPE_CODE (type) == TYPE_CODE_ERROR) + if (type->code () == TYPE_CODE_ERROR) error_unknown_type (msymbol->print_name ()); return value_from_longest (size_type, TYPE_LENGTH (type)); @@ -3249,10 +3249,10 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos, val = evaluate_subexp (NULL_TYPE, exp, &npc, EVAL_AVOID_SIDE_EFFECTS); type = check_typedef (value_type (val)); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { type = check_typedef (TYPE_TARGET_TYPE (type)); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { type = TYPE_INDEX_TYPE (type); /* Only re-evaluate the right hand side if the resulting type @@ -3364,14 +3364,14 @@ calc_f77_array_dims (struct type *array_type) int ndimen = 1; struct type *tmp_type; - if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY)) + if ((array_type->code () != TYPE_CODE_ARRAY)) error (_("Can't get dimensions for a non-array type")); tmp_type = array_type; while ((tmp_type = TYPE_TARGET_TYPE (tmp_type))) { - if (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY) + if (tmp_type->code () == TYPE_CODE_ARRAY) ++ndimen; } return ndimen; diff --git a/gdb/expprint.c b/gdb/expprint.c index 76880d2..a190d8c 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -448,7 +448,7 @@ print_subexp_standard (struct expression *exp, int *pos, (*pos) += 2; if ((int) prec > (int) PREC_PREFIX) fputs_filtered ("(", stream); - if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC + if (exp->elts[pc + 1].type->code () == TYPE_CODE_FUNC && exp->elts[pc + 3].opcode == OP_LONG) { struct value_print_options opts; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 6b7a5fb..3c3e6ab 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -268,7 +268,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) return eval_skip_value (exp); type = value_type (arg1); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: { @@ -292,9 +292,9 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) return eval_skip_value (exp); type = value_type (arg1); - if (TYPE_CODE (type) != TYPE_CODE (value_type (arg2))) + if (type->code () != value_type (arg2)->code ()) error (_("non-matching types for parameters to MOD ()")); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: { @@ -325,7 +325,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) return eval_skip_value (exp); type = value_type (arg1); - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) error (_("argument to CEILING must be of type float")); double val = target_float_to_host_double (value_contents (arg1), @@ -340,7 +340,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) return eval_skip_value (exp); type = value_type (arg1); - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) error (_("argument to FLOOR must be of type float")); double val = target_float_to_host_double (value_contents (arg1), @@ -356,10 +356,10 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) return eval_skip_value (exp); type = value_type (arg1); - if (TYPE_CODE (type) != TYPE_CODE (value_type (arg2))) + if (type->code () != value_type (arg2)->code ()) error (_("non-matching types for parameters to MODULO ()")); /* MODULO(A, P) = A - FLOOR (A / P) * P */ - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: { @@ -399,7 +399,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (NULL, exp, pos, EVAL_AVOID_SIDE_EFFECTS); type = value_type (arg1); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -412,7 +412,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, TYPE_LENGTH (type)); return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, - TYPE_LENGTH (TYPE_TARGET_TYPE(type))); + TYPE_LENGTH (TYPE_TARGET_TYPE (type))); } /* Should be unreachable. */ @@ -425,9 +425,9 @@ static bool f_is_string_type_p (struct type *type) { type = check_typedef (type); - return (TYPE_CODE (type) == TYPE_CODE_STRING - || (TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR)); + return (type->code () == TYPE_CODE_STRING + || (type->code () == TYPE_CODE_ARRAY + && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR)); } /* Special expression lengths for Fortran. */ @@ -745,7 +745,7 @@ build_fortran_types (struct gdbarch *gdbarch) builtin_f_type->builtin_complex_s16 = init_complex_type ("complex*16", builtin_f_type->builtin_real_s8); - if (TYPE_CODE (builtin_f_type->builtin_real_s16) == TYPE_CODE_ERROR) + if (builtin_f_type->builtin_real_s16->code () == TYPE_CODE_ERROR) builtin_f_type->builtin_complex_s32 = arch_type (gdbarch, TYPE_CODE_ERROR, 256, "complex*32"); else @@ -802,7 +802,7 @@ fortran_argument_convert (struct value *value, bool is_artificial) struct type * fortran_preserve_arg_pointer (struct value *arg, struct type *type) { - if (TYPE_CODE (value_type (arg)) == TYPE_CODE_PTR) + if (value_type (arg)->code () == TYPE_CODE_PTR) return value_type (arg); return type; } diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index e4a2beb..200896b 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -65,7 +65,7 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, enum type_code code; f_type_print_base (type, stream, show, level); - code = TYPE_CODE (type); + code = type->code (); if ((varstring != NULL && *varstring != '\0') /* Need a space if going to print stars or brackets; but not if we will print just a type name. */ @@ -76,10 +76,10 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, || code == TYPE_CODE_ARRAY || ((code == TYPE_CODE_PTR || code == TYPE_CODE_REF) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC - || (TYPE_CODE (TYPE_TARGET_TYPE (type)) + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC + || (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD) - || (TYPE_CODE (TYPE_TARGET_TYPE (type)) + || (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY)))))) fputs_filtered (" ", stream); f_type_print_varspec_prefix (type, stream, show, 0); @@ -119,7 +119,7 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream, QUIT; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1); @@ -183,7 +183,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, QUIT; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: arrayprint_recurse_level++; @@ -207,7 +207,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, print_rank_only = true; } - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) + if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY) f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, arrayprint_recurse_level, print_rank_only); @@ -233,7 +233,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, } } - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) + if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_ARRAY) f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, arrayprint_recurse_level, print_rank_only); @@ -335,18 +335,18 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, if ((show <= 0) && (TYPE_NAME (type) != NULL)) { const char *prefix = ""; - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) prefix = "Type, C_Union :: "; - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) prefix = "Type "; fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type)); return; } - if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF) + if (type->code () != TYPE_CODE_TYPEDEF) type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_TYPEDEF: f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); @@ -420,7 +420,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) fprintfi_filtered (level, stream, "Type, C_Union :: "); else fprintfi_filtered (level, stream, "Type "); @@ -459,7 +459,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, if (TYPE_NAME (type) != NULL) fprintfi_filtered (level, stream, "%s", TYPE_NAME (type)); else - error (_("Invalid type code (%d) in symbol table."), TYPE_CODE (type)); + error (_("Invalid type code (%d) in symbol table."), type->code ()); break; } diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 36328c7..76981fa 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -85,8 +85,8 @@ f77_get_dynamic_length_of_aggregate (struct type *type) This function also works for strings which behave very similarly to arrays. */ - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRING) + if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY + || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRING) f77_get_dynamic_length_of_aggregate (TYPE_TARGET_TYPE (type)); /* Recursion ends here, start setting up lengths. */ @@ -223,7 +223,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse, const gdb_byte *valaddr = value_contents_for_printing (val); const CORE_ADDR address = value_address (val); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRING: f77_get_dynamic_length_of_aggregate (type); @@ -232,7 +232,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse, break; case TYPE_CODE_ARRAY: - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_CHAR) + if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_CHAR) { fprintf_filtered (stream, "("); f77_print_array (type, valaddr, 0, @@ -263,7 +263,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse, addr = unpack_pointer (type, valaddr); elttype = check_typedef (TYPE_TARGET_TYPE (type)); - if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) + if (elttype->code () == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ print_function_pointer_address (options, gdbarch, addr, stream); @@ -282,7 +282,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse, /* For a pointer to char or unsigned char, also print the string pointed to, unless pointer is null. */ if (TYPE_LENGTH (elttype) == 1 - && TYPE_CODE (elttype) == TYPE_CODE_INT + && elttype->code () == TYPE_CODE_INT && (options->format == 0 || options->format == 's') && addr != 0) { @@ -320,7 +320,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse, struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, index)); - if (TYPE_CODE (field_type) != TYPE_CODE_FUNC) + if (field_type->code () != TYPE_CODE_FUNC) { const char *field_name; diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 54f5149..5deb251 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1983,9 +1983,9 @@ fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data) language_c, NULL).symbol; if (obj_entry_sym == NULL) error (_("Unable to find Struct_Obj_Entry symbol")); - data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE(obj_entry_sym), + data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym), "linkmap", 0).offset / 8; - data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE(obj_entry_sym), + data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym), "tlsindex", 0).offset / 8; data->rtld_offsets_valid = true; return; diff --git a/gdb/findvar.c b/gdb/findvar.c index ac4f5c3..40cbe8b 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -153,7 +153,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len, CORE_ADDR extract_typed_address (const gdb_byte *buf, struct type *type) { - if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) internal_error (__FILE__, __LINE__, _("extract_typed_address: " "type is not a pointer or reference")); @@ -206,7 +206,7 @@ template void store_integer (gdb_byte *addr, int len, void store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr) { - if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) internal_error (__FILE__, __LINE__, _("store_typed_address: " "type is not a pointer or reference")); @@ -257,7 +257,7 @@ copy_integer_to_size (gdb_byte *dest, int dest_size, const gdb_byte *source, /* Return a `value' with the contents of (virtual or cooked) register REGNUM as found in the specified FRAME. The register's type is - determined by register_type(). */ + determined by register_type (). */ struct value * value_of_register (int regnum, struct frame_info *frame) @@ -277,7 +277,7 @@ value_of_register (int regnum, struct frame_info *frame) /* Return a `value' with the contents of (virtual or cooked) register REGNUM as found in the specified FRAME. The register's type is - determined by register_type(). The value is not fetched. */ + determined by register_type (). The value is not fetched. */ struct value * value_of_register_lazy (struct frame_info *frame, int regnum) diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index ae383e7..fd76e52 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1240,7 +1240,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function, arg = args[argnum]; arg_type = check_typedef (value_type (arg)); len = TYPE_LENGTH (arg_type); - typecode = TYPE_CODE (arg_type); + typecode = arg_type->code (); if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) { @@ -1253,7 +1253,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function, else if (abi == FRV_ABI_FDPIC && len == 4 && typecode == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (arg_type)) == TYPE_CODE_FUNC) + && TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_FUNC) { /* The FDPIC ABI requires function descriptors to be passed instead of entry points. */ @@ -1345,9 +1345,9 @@ frv_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - int struct_return = TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY; + int struct_return = valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY; if (writebuf != NULL) { diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c index 787a3f4..24a7515 100644 --- a/gdb/gdbarch-selftests.c +++ b/gdb/gdbarch-selftests.c @@ -118,7 +118,7 @@ register_to_value_test (struct gdbarch *gdbarch) { std::vector<gdb_byte> expected (TYPE_LENGTH (type), 0); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) { /* Generate valid float format. */ target_float_from_string (expected.data (), type, "1.25"); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 671ee52..8f45af6 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -550,7 +550,7 @@ lookup_function_type_with_arguments (struct type *type, --nparams; TYPE_VARARGS (fn) = 1; } - else if (TYPE_CODE (check_typedef (param_types[nparams - 1])) + else if (check_typedef (param_types[nparams - 1])->code () == TYPE_CODE_VOID) { --nparams; @@ -923,7 +923,7 @@ create_range_type (struct type *result_type, struct type *index_type, { /* The INDEX_TYPE should be a type capable of holding the upper and lower bounds, as such a zero sized, or void type makes no sense. */ - gdb_assert (TYPE_CODE (index_type) != TYPE_CODE_VOID); + gdb_assert (index_type->code () != TYPE_CODE_VOID); gdb_assert (TYPE_LENGTH (index_type) > 0); if (result_type == NULL) @@ -1033,7 +1033,7 @@ int get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) { type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: *lowp = TYPE_LOW_BOUND (type); @@ -1155,7 +1155,7 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound) int discrete_position (struct type *type, LONGEST val, LONGEST *pos) { - if (TYPE_CODE (type) == TYPE_CODE_ENUM) + if (type->code () == TYPE_CODE_ENUM) { int i; @@ -1184,7 +1184,7 @@ discrete_position (struct type *type, LONGEST val, LONGEST *pos) static bool update_static_array_size (struct type *type) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY); + gdb_assert (type->code () == TYPE_CODE_ARRAY); struct type *range_type = TYPE_INDEX_TYPE (type); @@ -1413,11 +1413,11 @@ make_vector_type (struct type *array_type) /* Find the innermost array type, in case the array is multi-dimensional. */ inner_array = array_type; - while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY) + while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) inner_array = TYPE_TARGET_TYPE (inner_array); elt_type = TYPE_TARGET_TYPE (inner_array); - if (TYPE_CODE (elt_type) == TYPE_CODE_INT) + if (elt_type->code () == TYPE_CODE_INT) { flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT; elt_type = make_qualified_type (elt_type, flags, NULL); @@ -1446,7 +1446,7 @@ init_vector_type (struct type *elt_type, int n) struct type * internal_type_self_type (struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_METHODPTR: case TYPE_CODE_MEMBERPTR: @@ -1472,7 +1472,7 @@ internal_type_self_type (struct type *type) void set_type_self_type (struct type *type, struct type *self_type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_METHODPTR: case TYPE_CODE_MEMBERPTR: @@ -1644,7 +1644,7 @@ lookup_struct (const char *name, const struct block *block) { error (_("No struct type named %s."), name); } - if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT) + if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT) { error (_("This context has class, union or enum %s, not a struct."), name); @@ -1668,7 +1668,7 @@ lookup_union (const char *name, const struct block *block) t = SYMBOL_TYPE (sym); - if (TYPE_CODE (t) == TYPE_CODE_UNION) + if (t->code () == TYPE_CODE_UNION) return t; /* If we get here, it's not a union. */ @@ -1689,7 +1689,7 @@ lookup_enum (const char *name, const struct block *block) { error (_("No enum type named %s."), name); } - if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_ENUM) + if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_ENUM) { error (_("This context has class, struct or union %s, not an enum."), name); @@ -1719,7 +1719,7 @@ lookup_template_type (const char *name, struct type *type, { error (_("No template type named %s."), name); } - if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT) + if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT) { error (_("This context has class, union or enum %s, not a struct."), name); @@ -1737,14 +1737,14 @@ lookup_struct_elt (struct type *type, const char *name, int noerr) for (;;) { type = check_typedef (type); - if (TYPE_CODE (type) != TYPE_CODE_PTR - && TYPE_CODE (type) != TYPE_CODE_REF) + if (type->code () != TYPE_CODE_PTR + && type->code () != TYPE_CODE_REF) break; type = TYPE_TARGET_TYPE (type); } - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) { std::string type_name = type_to_string (type); error (_("Type %s is not a structure or union type."), @@ -1807,7 +1807,7 @@ get_unsigned_type_max (struct type *type, ULONGEST *max) unsigned int n; type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_INT && TYPE_UNSIGNED (type)); + gdb_assert (type->code () == TYPE_CODE_INT && TYPE_UNSIGNED (type)); gdb_assert (TYPE_LENGTH (type) <= sizeof (ULONGEST)); /* Written this way to avoid overflow. */ @@ -1824,7 +1824,7 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max) unsigned int n; type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_INT && !TYPE_UNSIGNED (type)); + gdb_assert (type->code () == TYPE_CODE_INT && !TYPE_UNSIGNED (type)); gdb_assert (TYPE_LENGTH (type) <= sizeof (LONGEST)); n = TYPE_LENGTH (type) * TARGET_CHAR_BIT; @@ -1843,8 +1843,8 @@ int internal_type_vptr_fieldno (struct type *type) { type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); if (!HAVE_CPLUS_STRUCT (type)) return -1; return TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_fieldno; @@ -1856,8 +1856,8 @@ void set_type_vptr_fieldno (struct type *type, int fieldno) { type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); if (!HAVE_CPLUS_STRUCT (type)) ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_fieldno = fieldno; @@ -1870,8 +1870,8 @@ struct type * internal_type_vptr_basetype (struct type *type) { type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF); return TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_basetype; } @@ -1882,8 +1882,8 @@ void set_type_vptr_basetype (struct type *type, struct type *basetype) { type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); if (!HAVE_CPLUS_STRUCT (type)) ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_basetype = basetype; @@ -1970,7 +1970,7 @@ is_dynamic_type_internal (struct type *type, int top_level) type = check_typedef (type); /* We only want to recognize references at the outermost level. */ - if (top_level && TYPE_CODE (type) == TYPE_CODE_REF) + if (top_level && type->code () == TYPE_CODE_REF) type = check_typedef (TYPE_TARGET_TYPE (type)); /* Types that have a dynamic TYPE_DATA_LOCATION are considered @@ -1997,7 +1997,7 @@ is_dynamic_type_internal (struct type *type, int top_level) if (TYPE_HAS_DYNAMIC_LENGTH (type)) return 1; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: { @@ -2086,7 +2086,7 @@ resolve_dynamic_range (struct type *dyn_range_type, const struct dynamic_prop *prop; struct dynamic_prop low_bound, high_bound, stride; - gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE); + gdb_assert (dyn_range_type->code () == TYPE_CODE_RANGE); prop = &TYPE_RANGE_DATA (dyn_range_type)->low; if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) @@ -2168,8 +2168,8 @@ resolve_dynamic_array_or_string (struct type *type, /* For dynamic type resolution strings can be treated like arrays of characters. */ - gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY - || TYPE_CODE (type) == TYPE_CODE_STRING); + gdb_assert (type->code () == TYPE_CODE_ARRAY + || type->code () == TYPE_CODE_STRING); type = copy_type (type); @@ -2194,7 +2194,7 @@ resolve_dynamic_array_or_string (struct type *type, ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); - if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY) + if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY) elt_type = resolve_dynamic_array_or_string (ary_dim, addr_stack); else elt_type = TYPE_TARGET_TYPE (type); @@ -2235,7 +2235,7 @@ resolve_dynamic_union (struct type *type, int i; unsigned int max_len = 0; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_UNION); resolved_type = copy_type (type); TYPE_FIELDS (resolved_type) @@ -2431,7 +2431,7 @@ resolve_dynamic_struct (struct type *type, int i; unsigned resolved_type_bit_length = 0; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT); + gdb_assert (type->code () == TYPE_CODE_STRUCT); gdb_assert (TYPE_NFIELDS (type) > 0); resolved_type = copy_type (type); @@ -2560,7 +2560,7 @@ resolve_dynamic_type_internal (struct type *type, && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) type_length = value; - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (type->code () == TYPE_CODE_TYPEDEF) { resolved_type = copy_type (type); TYPE_TARGET_TYPE (resolved_type) @@ -2572,7 +2572,7 @@ resolve_dynamic_type_internal (struct type *type, /* Before trying to resolve TYPE, make sure it is not a stub. */ type = real_type; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_REF: { @@ -2752,7 +2752,7 @@ check_typedef (struct type *type) gdb_assert (type); - while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + while (type->code () == TYPE_CODE_TYPEDEF) { if (!TYPE_TARGET_TYPE (type)) { @@ -2867,7 +2867,7 @@ check_typedef (struct type *type) /* Same as above for opaque types, we can replace the stub with the complete type only if they are in the same objfile. */ - if (TYPE_OBJFILE (SYMBOL_TYPE(sym)) == TYPE_OBJFILE (type)) + if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type)) type = make_qualified_type (SYMBOL_TYPE (sym), TYPE_INSTANCE_FLAGS (type), type); @@ -2884,12 +2884,12 @@ check_typedef (struct type *type) { /* Nothing we can do. */ } - else if (TYPE_CODE (type) == TYPE_CODE_RANGE) + else if (type->code () == TYPE_CODE_RANGE) { TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY + else if (type->code () == TYPE_CODE_ARRAY && update_static_array_size (type)) TYPE_TARGET_STUB (type) = 0; } @@ -3153,7 +3153,7 @@ verify_floatformat (int bit, const struct floatformat *floatformat) const struct floatformat * floatformat_from_type (const struct type *type) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + gdb_assert (type->code () == TYPE_CODE_FLT); gdb_assert (TYPE_FLOATFORMAT (type)); return TYPE_FLOATFORMAT (type); } @@ -3288,8 +3288,8 @@ init_complex_type (const char *name, struct type *target_type) { struct type *t; - gdb_assert (TYPE_CODE (target_type) == TYPE_CODE_INT - || TYPE_CODE (target_type) == TYPE_CODE_FLT); + gdb_assert (target_type->code () == TYPE_CODE_INT + || target_type->code () == TYPE_CODE_FLT); if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr) { @@ -3359,7 +3359,7 @@ type_align (struct type *type) if (align != 0) return align; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_FUNC: @@ -3469,8 +3469,8 @@ can_dereference (struct type *t) t = check_typedef (t); return (t != NULL - && TYPE_CODE (t) == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID); + && t->code () == TYPE_CODE_PTR + && TYPE_TARGET_TYPE (t)->code () != TYPE_CODE_VOID); } int @@ -3479,12 +3479,12 @@ is_integral_type (struct type *t) t = check_typedef (t); return ((t != NULL) - && ((TYPE_CODE (t) == TYPE_CODE_INT) - || (TYPE_CODE (t) == TYPE_CODE_ENUM) - || (TYPE_CODE (t) == TYPE_CODE_FLAGS) - || (TYPE_CODE (t) == TYPE_CODE_CHAR) - || (TYPE_CODE (t) == TYPE_CODE_RANGE) - || (TYPE_CODE (t) == TYPE_CODE_BOOL))); + && ((t->code () == TYPE_CODE_INT) + || (t->code () == TYPE_CODE_ENUM) + || (t->code () == TYPE_CODE_FLAGS) + || (t->code () == TYPE_CODE_CHAR) + || (t->code () == TYPE_CODE_RANGE) + || (t->code () == TYPE_CODE_BOOL))); } int @@ -3493,8 +3493,8 @@ is_floating_type (struct type *t) t = check_typedef (t); return ((t != NULL) - && ((TYPE_CODE (t) == TYPE_CODE_FLT) - || (TYPE_CODE (t) == TYPE_CODE_DECFLOAT))); + && ((t->code () == TYPE_CODE_FLT) + || (t->code () == TYPE_CODE_DECFLOAT))); } /* Return true if TYPE is scalar. */ @@ -3504,7 +3504,7 @@ is_scalar_type (struct type *type) { type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: case TYPE_CODE_STRUCT: @@ -3529,9 +3529,9 @@ is_scalar_type_recursive (struct type *t) if (is_scalar_type (t)) return 1; /* Are we dealing with an array or string of known dimensions? */ - else if ((TYPE_CODE (t) == TYPE_CODE_ARRAY - || TYPE_CODE (t) == TYPE_CODE_STRING) && TYPE_NFIELDS (t) == 1 - && TYPE_CODE (TYPE_INDEX_TYPE (t)) == TYPE_CODE_RANGE) + else if ((t->code () == TYPE_CODE_ARRAY + || t->code () == TYPE_CODE_STRING) && TYPE_NFIELDS (t) == 1 + && TYPE_INDEX_TYPE(t)->code () == TYPE_CODE_RANGE) { LONGEST low_bound, high_bound; struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (t)); @@ -3541,9 +3541,9 @@ is_scalar_type_recursive (struct type *t) return high_bound == low_bound && is_scalar_type_recursive (elt_type); } /* Are we dealing with a struct with one element? */ - else if (TYPE_CODE (t) == TYPE_CODE_STRUCT && TYPE_NFIELDS (t) == 1) + else if (t->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (t) == 1) return is_scalar_type_recursive (TYPE_FIELD_TYPE (t, 0)); - else if (TYPE_CODE (t) == TYPE_CODE_UNION) + else if (t->code () == TYPE_CODE_UNION) { int i, n = TYPE_NFIELDS (t); @@ -3563,8 +3563,8 @@ is_scalar_type_recursive (struct type *t) int class_or_union_p (const struct type *t) { - return (TYPE_CODE (t) == TYPE_CODE_STRUCT - || TYPE_CODE (t) == TYPE_CODE_UNION); + return (t->code () == TYPE_CODE_STRUCT + || t->code () == TYPE_CODE_UNION); } /* A helper function which returns true if types A and B represent the @@ -3906,21 +3906,21 @@ types_equal (struct type *a, struct type *b) return true; /* Resolve typedefs */ - if (TYPE_CODE (a) == TYPE_CODE_TYPEDEF) + if (a->code () == TYPE_CODE_TYPEDEF) a = check_typedef (a); - if (TYPE_CODE (b) == TYPE_CODE_TYPEDEF) + if (b->code () == TYPE_CODE_TYPEDEF) b = check_typedef (b); /* If after resolving typedefs a and b are not of the same type code then they are not equal. */ - if (TYPE_CODE (a) != TYPE_CODE (b)) + if (a->code () != b->code ()) return false; /* If a and b are both pointers types or both reference types then they are equal of the same type iff the objects they refer to are of the same type. */ - if (TYPE_CODE (a) == TYPE_CODE_PTR - || TYPE_CODE (a) == TYPE_CODE_REF) + if (a->code () == TYPE_CODE_PTR + || a->code () == TYPE_CODE_REF) return types_equal (TYPE_TARGET_TYPE (a), TYPE_TARGET_TYPE (b)); @@ -3939,7 +3939,7 @@ types_equal (struct type *a, struct type *b) /* Two function types are equal if their argument and return types are equal. */ - if (TYPE_CODE (a) == TYPE_CODE_FUNC) + if (a->code () == TYPE_CODE_FUNC) { int i; @@ -3999,7 +3999,7 @@ check_types_equal (struct type *type1, struct type *type2, if (type1 == type2) return true; - if (TYPE_CODE (type1) != TYPE_CODE (type2) + if (type1->code () != type2->code () || TYPE_LENGTH (type1) != TYPE_LENGTH (type2) || TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2) || TYPE_NOSIGN (type1) != TYPE_NOSIGN (type2) @@ -4016,7 +4016,7 @@ check_types_equal (struct type *type1, struct type *type2, if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2))) return false; - if (TYPE_CODE (type1) == TYPE_CODE_RANGE) + if (type1->code () == TYPE_CODE_RANGE) { if (*TYPE_RANGE_DATA (type1) != *TYPE_RANGE_DATA (type2)) return false; @@ -4170,13 +4170,13 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value { struct rank rank = {0,0}; - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_PTR: /* Allowed pointer conversions are: (a) pointer to void-pointer conversion. */ - if (TYPE_CODE (TYPE_TARGET_TYPE (parm)) == TYPE_CODE_VOID) + if (TYPE_TARGET_TYPE (parm)->code () == TYPE_CODE_VOID) return VOID_PTR_CONVERSION_BADNESS; /* (b) pointer to ancestor-pointer conversion. */ @@ -4208,7 +4208,7 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value case TYPE_CODE_FUNC: return rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL); case TYPE_CODE_INT: - if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT) + if (value != NULL && value_type (value)->code () == TYPE_CODE_INT) { if (value_as_long (value) == 0) { @@ -4239,7 +4239,7 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value static struct rank rank_one_type_parm_array (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_ARRAY: @@ -4255,7 +4255,7 @@ rank_one_type_parm_array (struct type *parm, struct type *arg, struct value *val static struct rank rank_one_type_parm_func (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_PTR: /* funcptr -> func */ return rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL); @@ -4269,7 +4269,7 @@ rank_one_type_parm_func (struct type *parm, struct type *arg, struct value *valu static struct rank rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_INT: if (TYPE_LENGTH (arg) == TYPE_LENGTH (parm)) @@ -4358,7 +4358,7 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value static struct rank rank_one_type_parm_enum (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_INT: case TYPE_CODE_CHAR: @@ -4380,7 +4380,7 @@ rank_one_type_parm_enum (struct type *parm, struct type *arg, struct value *valu static struct rank rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_RANGE: case TYPE_CODE_BOOL: @@ -4427,7 +4427,7 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu static struct rank rank_one_type_parm_range (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_INT: case TYPE_CODE_CHAR: @@ -4447,7 +4447,7 @@ rank_one_type_parm_range (struct type *parm, struct type *arg, struct value *val static struct rank rank_one_type_parm_bool (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { /* n3290 draft, section 4.12.1 (conv.bool): @@ -4478,7 +4478,7 @@ rank_one_type_parm_bool (struct type *parm, struct type *arg, struct value *valu static struct rank rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_FLT: if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm)) @@ -4503,7 +4503,7 @@ rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *val static struct rank rank_one_type_parm_complex (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { /* Strictly not needed for C++, but... */ case TYPE_CODE_FLT: return FLOAT_PROMOTION_BADNESS; @@ -4521,7 +4521,7 @@ rank_one_type_parm_struct (struct type *parm, struct type *arg, struct value *va { struct rank rank = {0, 0}; - switch (TYPE_CODE (arg)) + switch (arg->code ()) { case TYPE_CODE_STRUCT: /* Check for derivation */ @@ -4539,7 +4539,7 @@ rank_one_type_parm_struct (struct type *parm, struct type *arg, struct value *va static struct rank rank_one_type_parm_set (struct type *parm, struct type *arg, struct value *value) { - switch (TYPE_CODE (arg)) + switch (arg->code ()) { /* Not in C++ */ case TYPE_CODE_SET: @@ -4567,9 +4567,9 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) struct rank rank = {0,0}; /* Resolve typedefs */ - if (TYPE_CODE (parm) == TYPE_CODE_TYPEDEF) + if (parm->code () == TYPE_CODE_TYPEDEF) parm = check_typedef (parm); - if (TYPE_CODE (arg) == TYPE_CODE_TYPEDEF) + if (arg->code () == TYPE_CODE_TYPEDEF) arg = check_typedef (arg); if (TYPE_IS_REFERENCE (parm) && value != NULL) @@ -4578,7 +4578,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) { /* Rvalues should preferably bind to rvalue references or const lvalue references. */ - if (TYPE_CODE (parm) == TYPE_CODE_RVALUE_REF) + if (parm->code () == TYPE_CODE_RVALUE_REF) rank.subrank = REFERENCE_CONVERSION_RVALUE; else if (TYPE_CONST (TYPE_TARGET_TYPE (parm))) rank.subrank = REFERENCE_CONVERSION_CONST_LVALUE; @@ -4589,7 +4589,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) else { /* It's illegal to pass an lvalue as an rvalue. */ - if (TYPE_CODE (parm) == TYPE_CODE_RVALUE_REF) + if (parm->code () == TYPE_CODE_RVALUE_REF) return INCOMPATIBLE_TYPE_BADNESS; } } @@ -4600,7 +4600,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) struct type *t2 = arg; /* For pointers and references, compare target type. */ - if (TYPE_CODE (parm) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (parm)) + if (parm->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (parm)) { t1 = TYPE_TARGET_TYPE (parm); t2 = TYPE_TARGET_TYPE (arg); @@ -4627,14 +4627,14 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) REFERENCE_SEE_THROUGH_BADNESS)); if (overload_debug) /* Debugging only. */ - fprintf_filtered (gdb_stderr, + fprintf_filtered (gdb_stderr, "------ Arg is %s [%d], parm is %s [%d]\n", - TYPE_NAME (arg), TYPE_CODE (arg), - TYPE_NAME (parm), TYPE_CODE (parm)); + TYPE_NAME (arg), arg->code (), + TYPE_NAME (parm), parm->code ()); /* x -> y means arg of type x being supplied for parameter of type y. */ - switch (TYPE_CODE (parm)) + switch (parm->code ()) { case TYPE_CODE_PTR: return rank_one_type_parm_ptr (parm, arg, value); @@ -4662,7 +4662,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) return rank_one_type_parm_set (parm, arg, value); default: return INCOMPATIBLE_TYPE_BADNESS; - } /* switch (TYPE_CODE (arg)) */ + } /* switch (arg->code ()) */ } /* End of functions for overload resolution. */ @@ -4908,8 +4908,8 @@ recursive_dump_type (struct type *type, int spaces) TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>"); gdb_print_host_address (TYPE_NAME (type), gdb_stdout); printf_filtered (")\n"); - printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type)); - switch (TYPE_CODE (type)) + printfi_filtered (spaces, "code 0x%x ", type->code ()); + switch (type->code ()) { case TYPE_CODE_UNDEF: printf_filtered ("(TYPE_CODE_UNDEF)"); @@ -5106,7 +5106,7 @@ recursive_dump_type (struct type *type, int spaces) puts_filtered ("\n"); for (idx = 0; idx < TYPE_NFIELDS (type); idx++) { - if (TYPE_CODE (type) == TYPE_CODE_ENUM) + if (type->code () == TYPE_CODE_ENUM) printfi_filtered (spaces + 2, "[%d] enumval %s type ", idx, plongest (TYPE_FIELD_ENUMVAL (type, idx))); @@ -5127,7 +5127,7 @@ recursive_dump_type (struct type *type, int spaces) recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4); } } - if (TYPE_CODE (type) == TYPE_CODE_RANGE) + if (type->code () == TYPE_CODE_RANGE) { printfi_filtered (spaces, "low %s%s high %s%s\n", plongest (TYPE_LOW_BOUND (type)), @@ -5343,7 +5343,7 @@ copy_type_recursive (struct objfile *objfile, } /* For range types, copy the bounds information. */ - if (TYPE_CODE (type) == TYPE_CODE_RANGE) + if (type->code () == TYPE_CODE_RANGE) { TYPE_RANGE_DATA (new_type) = (struct range_bounds *) TYPE_ALLOC (new_type, sizeof (struct range_bounds)); @@ -5577,7 +5577,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits, int type_bitsize = TYPE_LENGTH (type) * TARGET_CHAR_BIT; int field_nr = TYPE_NFIELDS (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLAGS); + gdb_assert (type->code () == TYPE_CODE_FLAGS); gdb_assert (TYPE_NFIELDS (type) + 1 <= type_bitsize); gdb_assert (start_bitpos >= 0 && start_bitpos < type_bitsize); gdb_assert (nr_bits >= 1 && nr_bits <= type_bitsize); @@ -5649,12 +5649,12 @@ append_composite_type_field_aligned (struct type *t, const char *name, { struct field *f = append_composite_type_field_raw (t, name, field); - if (TYPE_CODE (t) == TYPE_CODE_UNION) + if (t->code () == TYPE_CODE_UNION) { if (TYPE_LENGTH (t) < TYPE_LENGTH (field)) TYPE_LENGTH (t) = TYPE_LENGTH (field); } - else if (TYPE_CODE (t) == TYPE_CODE_STRUCT) + else if (t->code () == TYPE_CODE_STRUCT) { TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field); if (TYPE_NFIELDS (t) > 1) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 9f4924e..a8cd44a 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -335,7 +335,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); /* * True if this type represents either an lvalue or lvalue reference type. */ #define TYPE_IS_REFERENCE(t) \ - (TYPE_CODE (t) == TYPE_CODE_REF || TYPE_CODE (t) == TYPE_CODE_RVALUE_REF) + ((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF) /* * True if this type is allocatable. */ #define TYPE_IS_ALLOCATABLE(t) \ @@ -1435,7 +1435,6 @@ extern unsigned type_align (struct type *); space in struct type. */ extern bool set_type_align (struct type *, ULONGEST); -#define TYPE_CODE(thistype) ((thistype)->code ()) #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields @@ -1681,8 +1680,8 @@ extern void set_type_vptr_basetype (struct type *, struct type *); TYPE_NESTED_TYPES_FIELD (thistype, n).is_private #define TYPE_IS_OPAQUE(thistype) \ - (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) \ - || (TYPE_CODE (thistype) == TYPE_CODE_UNION)) \ + ((((thistype)->code () == TYPE_CODE_STRUCT) \ + || ((thistype)->code () == TYPE_CODE_UNION)) \ && (TYPE_NFIELDS (thistype) == 0) \ && (!HAVE_CPLUS_STRUCT (thistype) \ || TYPE_NFN_FIELDS (thistype) == 0) \ diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index a9b2e0a..bf438a8 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -132,8 +132,8 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, /* With older versions of g++, the vtbl field pointed to an array of structures. Nowadays it points directly to the structure. */ - if (TYPE_CODE (value_type (vtbl)) == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (value_type (vtbl))) == TYPE_CODE_ARRAY) + if (value_type (vtbl)->code () == TYPE_CODE_PTR + && TYPE_TARGET_TYPE (value_type (vtbl))->code () == TYPE_CODE_ARRAY) { /* Handle the case where the vtbl field points to an array of structures. */ @@ -155,7 +155,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, entry_type = check_typedef (value_type (entry)); - if (TYPE_CODE (entry_type) == TYPE_CODE_STRUCT) + if (entry_type->code () == TYPE_CODE_STRUCT) { /* Move the `this' pointer according to the virtual function table. */ set_value_offset (arg1, value_offset (arg1) @@ -169,7 +169,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, vfn = value_field (entry, 2); } - else if (TYPE_CODE (entry_type) == TYPE_CODE_PTR) + else if (entry_type->code () == TYPE_CODE_PTR) vfn = entry; else error (_("I'm confused: virtual function table has bad type")); @@ -206,7 +206,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc) known_type = value_type (v); known_type = check_typedef (known_type); /* RTTI works only or class objects. */ - if (TYPE_CODE (known_type) != TYPE_CODE_STRUCT) + if (known_type->code () != TYPE_CODE_STRUCT) return NULL; /* Plan on this changing in the future as i get around to setting @@ -314,7 +314,7 @@ vb_match (struct type *type, int index, struct type *basetype) it is for this baseclass. */ fieldtype = TYPE_FIELD_TYPE (type, index); if (fieldtype == NULL - || TYPE_CODE (fieldtype) != TYPE_CODE_PTR) + || fieldtype->code () != TYPE_CODE_PTR) /* "Can't happen". */ return 0; diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 83deed5..1fe3a96 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -208,10 +208,10 @@ gnuv3_dynamic_class (struct type *type) int fieldnum, fieldelem; type = check_typedef (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + gdb_assert (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) return 0; if (TYPE_CPLUS_DYNAMIC (type)) @@ -259,7 +259,7 @@ gnuv3_get_vtable (struct gdbarch *gdbarch, CORE_ADDR vtable_address; container_type = check_typedef (container_type); - gdb_assert (TYPE_CODE (container_type) == TYPE_CODE_STRUCT); + gdb_assert (container_type->code () == TYPE_CODE_STRUCT); /* If this type does not have a virtual table, don't read the first field. */ @@ -303,7 +303,7 @@ gnuv3_rtti_type (struct value *value, const char *atsign; /* We only have RTTI for dynamic class objects. */ - if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT + if (values_type->code () != TYPE_CODE_STRUCT || !gnuv3_dynamic_class (values_type)) return NULL; @@ -418,7 +418,7 @@ gnuv3_virtual_fn_field (struct value **value_p, struct gdbarch *gdbarch; /* Some simple sanity checks. */ - if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT) + if (values_type->code () != TYPE_CODE_STRUCT) error (_("Only classes can have virtual functions.")); /* Determine architecture. */ @@ -849,7 +849,7 @@ compute_vtable_size (htab_t offset_hash, void **slot; struct value_and_voffset search_vo, *current_vo; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT); + gdb_assert (type->code () == TYPE_CODE_STRUCT); /* If the object is not dynamic, then we are done; as it cannot have dynamic base types either. */ @@ -964,7 +964,7 @@ gnuv3_print_vtable (struct value *value) value = coerce_ref (value); type = check_typedef (value_type (value)); - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { value = value_ind (value); type = check_typedef (value_type (value)); @@ -982,7 +982,7 @@ gnuv3_print_vtable (struct value *value) gdbarch = get_type_arch (type); vtable = NULL; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) vtable = gnuv3_get_vtable (gdbarch, type, value_as_address (value_addr (value))); @@ -1103,7 +1103,7 @@ gnuv3_get_typeid (struct value *value) /* In the non_lvalue case, a reference might have slipped through here. */ - if (TYPE_CODE (type) == TYPE_CODE_REF) + if (type->code () == TYPE_CODE_REF) type = check_typedef (TYPE_TARGET_TYPE (type)); /* Ignore top-level cv-qualifiers. */ @@ -1127,7 +1127,7 @@ gnuv3_get_typeid (struct value *value) /* We check for lval_memory because in the "typeid (type-id)" case, the type is passed via a not_lval value object. */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT + if (type->code () == TYPE_CODE_STRUCT && value_lval_const (value) == lval_memory && gnuv3_dynamic_class (type)) { @@ -1333,7 +1333,7 @@ is_copy_or_move_constructor_type (struct type *class_type, type, with the expected type code... */ struct type *arg_type = TYPE_FIELD_TYPE (method_type, 1); - if (TYPE_CODE (arg_type) != expected) + if (arg_type->code () != expected) return false; struct type *target = check_typedef (TYPE_TARGET_TYPE (arg_type)); @@ -1417,8 +1417,8 @@ gnuv3_pass_by_reference (struct type *type) definition_style mctor_def = DOES_NOT_EXIST_IN_SOURCE; /* We're only interested in things that can have methods. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) return info; /* The compiler may have emitted the calling convention attribute. @@ -1533,7 +1533,7 @@ gnuv3_pass_by_reference (struct type *type) struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum); /* For arrays, make the decision based on the element type. */ - if (TYPE_CODE (field_type) == TYPE_CODE_ARRAY) + if (field_type->code () == TYPE_CODE_ARRAY) field_type = check_typedef (TYPE_TARGET_TYPE (field_type)); struct language_pass_by_ref_info field_info diff --git a/gdb/go-exp.y b/gdb/go-exp.y index dd84ae5..17c76ac 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1333,7 +1333,7 @@ package_name_p (const char *name, const struct block *block) if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF - && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_MODULE) + && SYMBOL_TYPE (sym)->code () == TYPE_CODE_MODULE) return 1; return 0; diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 03dc986..373c12d 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -81,16 +81,16 @@ gccgo_string_p (struct type *type) type0 = check_typedef (type0); type1 = check_typedef (type1); - if (TYPE_CODE (type0) == TYPE_CODE_PTR + if (type0->code () == TYPE_CODE_PTR && strcmp (TYPE_FIELD_NAME (type, 0), "__data") == 0 - && TYPE_CODE (type1) == TYPE_CODE_INT + && type1->code () == TYPE_CODE_INT && strcmp (TYPE_FIELD_NAME (type, 1), "__length") == 0) { struct type *target_type = TYPE_TARGET_TYPE (type0); target_type = check_typedef (target_type); - if (TYPE_CODE (target_type) == TYPE_CODE_INT + if (target_type->code () == TYPE_CODE_INT && TYPE_LENGTH (target_type) == 1 && strcmp (TYPE_NAME (target_type), "uint8") == 0) return 1; @@ -137,7 +137,7 @@ static bool go_is_string_type_p (struct type *type) { type = check_typedef (type); - return (TYPE_CODE (type) == TYPE_CODE_STRUCT + return (type->code () == TYPE_CODE_STRUCT && go_classify_struct_type (type) == GO_TYPE_STRING); } diff --git a/gdb/go-typeprint.c b/gdb/go-typeprint.c index 763ae54..c334914 100644 --- a/gdb/go-typeprint.c +++ b/gdb/go-typeprint.c @@ -51,8 +51,8 @@ go_print_type (struct type *type, const char *varstring, type = check_typedef (type); /* Print the type of "abc" as "string", not char[4]. */ - if (TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR) + if (type->code () == TYPE_CODE_ARRAY + && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR) { fputs_filtered ("string", stream); return; diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c index fe2ee46..1933e98 100644 --- a/gdb/go-valprint.c +++ b/gdb/go-valprint.c @@ -92,7 +92,7 @@ go_value_print_inner (struct value *val, struct ui_file *stream, { struct type *type = check_typedef (value_type (val)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: { diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c index 6e5ee6c..0df1b3a 100644 --- a/gdb/guile/scm-lazy-string.c +++ b/gdb/guile/scm-lazy-string.c @@ -201,7 +201,7 @@ lsscm_elt_type (lazy_string_smob *ls_smob) realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_ARRAY: @@ -314,7 +314,7 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos, struct type *type = tyscm_scm_to_type (ls_smob->type); struct type *realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_PTR: /* If a length is specified we need to convert this to an array diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c index 12784d6..7c63fa2 100644 --- a/gdb/guile/scm-math.c +++ b/gdb/guile/scm-math.c @@ -65,7 +65,7 @@ enum valscm_binary_opcode /* If TYPE is a reference, return the target; otherwise return TYPE. */ #define STRIP_REFERENCE(TYPE) \ - ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE)) + ((TYPE->code () == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE)) /* Helper for vlscm_unop. Contains all the code that may throw a GDB exception. */ @@ -168,10 +168,10 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y, rtype = check_typedef (rtype); rtype = STRIP_REFERENCE (rtype); - if (TYPE_CODE (ltype) == TYPE_CODE_PTR + if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype)) res_val = value_ptradd (arg1, value_as_long (arg2)); - else if (TYPE_CODE (rtype) == TYPE_CODE_PTR + else if (rtype->code () == TYPE_CODE_PTR && is_integral_type (ltype)) res_val = value_ptradd (arg2, value_as_long (arg1)); else @@ -188,15 +188,15 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y, rtype = check_typedef (rtype); rtype = STRIP_REFERENCE (rtype); - if (TYPE_CODE (ltype) == TYPE_CODE_PTR - && TYPE_CODE (rtype) == TYPE_CODE_PTR) + if (ltype->code () == TYPE_CODE_PTR + && rtype->code () == TYPE_CODE_PTR) { /* A ptrdiff_t for the target would be preferable here. */ res_val = value_from_longest (builtin_type (gdbarch)->builtin_long, value_ptrdiff (arg1, arg2)); } - else if (TYPE_CODE (ltype) == TYPE_CODE_PTR + else if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype)) res_val = value_ptradd (arg1, - value_as_long (arg2)); else @@ -525,7 +525,7 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, struct gdbarch *gdbarch, SCM *except_scmp) { if (is_integral_type (type) - || TYPE_CODE (type) == TYPE_CODE_PTR) + || type->code () == TYPE_CODE_PTR) { if (TYPE_UNSIGNED (type)) { @@ -558,7 +558,7 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, return value_from_longest (type, gdbscm_scm_to_longest (obj)); } } - else if (TYPE_CODE (type) == TYPE_CODE_FLT) + else if (type->code () == TYPE_CODE_FLT) return value_from_host_double (type, scm_to_double (obj)); else { diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index bf2f751..521f484 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -529,7 +529,7 @@ gdbscm_type_code (SCM self) = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct type *type = t_smob->type; - return scm_from_int (TYPE_CODE (type)); + return scm_from_int (type->code ()); } /* (type-fields <gdb:type>) -> list @@ -577,9 +577,9 @@ gdbscm_type_tag (SCM self) struct type *type = t_smob->type; const char *tagname = nullptr; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ENUM) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ENUM) tagname = TYPE_NAME (type); if (tagname == nullptr) @@ -685,17 +685,17 @@ tyscm_get_composite (struct type *type) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - if (TYPE_CODE (type) != TYPE_CODE_PTR - && TYPE_CODE (type) != TYPE_CODE_REF) + if (type->code () != TYPE_CODE_PTR + && type->code () != TYPE_CODE_REF) break; type = TYPE_TARGET_TYPE (type); } /* If this is not a struct, union, or enum type, raise TypeError exception. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_ENUM) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION + && type->code () != TYPE_CODE_ENUM) return NULL; return type; @@ -817,12 +817,12 @@ gdbscm_type_range (SCM self) /* Initialize these to appease GCC warnings. */ LONGEST low = 0, high = 0; - SCM_ASSERT_TYPE (TYPE_CODE (type) == TYPE_CODE_ARRAY - || TYPE_CODE (type) == TYPE_CODE_STRING - || TYPE_CODE (type) == TYPE_CODE_RANGE, + SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ARRAY + || type->code () == TYPE_CODE_STRING + || type->code () == TYPE_CODE_RANGE, self, SCM_ARG1, FUNC_NAME, _("ranged type")); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: case TYPE_CODE_STRING: @@ -1163,7 +1163,7 @@ gdbscm_field_enumval (SCM self) struct field *field = tyscm_field_smob_to_field (f_smob); struct type *type = tyscm_field_smob_containing_type (f_smob); - SCM_ASSERT_TYPE (TYPE_CODE (type) == TYPE_CODE_ENUM, + SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME, _("enum type")); return scm_from_long (FIELD_ENUMVAL (*field)); @@ -1180,7 +1180,7 @@ gdbscm_field_bitpos (SCM self) struct field *field = tyscm_field_smob_to_field (f_smob); struct type *type = tyscm_field_smob_containing_type (f_smob); - SCM_ASSERT_TYPE (TYPE_CODE (type) != TYPE_CODE_ENUM, + SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME, _("non-enum type")); return scm_from_long (FIELD_BITPOS (*field)); @@ -1222,7 +1222,7 @@ gdbscm_field_baseclass_p (SCM self) = tyscm_get_field_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct type *type = tyscm_field_smob_containing_type (f_smob); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type)); return SCM_BOOL_F; } diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 53b373e..c4d4045 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -470,7 +470,7 @@ gdbscm_value_referenced_value (SCM self) struct value *res_val; - switch (TYPE_CODE (check_typedef (value_type (value)))) + switch (check_typedef (value_type (value))->code ()) { case TYPE_CODE_PTR: res_val = value_ind (value); @@ -523,12 +523,12 @@ gdbscm_value_dynamic_type (SCM self) type = value_type (value); type = check_typedef (type); - if (((TYPE_CODE (type) == TYPE_CODE_PTR) - || (TYPE_CODE (type) == TYPE_CODE_REF)) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) + if (((type->code () == TYPE_CODE_PTR) + || (type->code () == TYPE_CODE_REF)) + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) { struct value *target; - int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR; + int was_pointer = type->code () == TYPE_CODE_PTR; if (was_pointer) target = value_ind (value); @@ -544,7 +544,7 @@ gdbscm_value_dynamic_type (SCM self) type = lookup_lvalue_reference_type (type); } } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) type = value_rtti_type (value, NULL, NULL, NULL); else { @@ -682,8 +682,8 @@ gdbscm_value_subscript (SCM self, SCM index_scm) a subscript. */ struct value *tmp = coerce_ref (value); struct type *tmp_type = check_typedef (value_type (tmp)); - if (TYPE_CODE (tmp_type) != TYPE_CODE_ARRAY - && TYPE_CODE (tmp_type) != TYPE_CODE_PTR) + if (tmp_type->code () != TYPE_CODE_ARRAY + && tmp_type->code () != TYPE_CODE_PTR) error (_("Cannot subscript requested type")); struct value *res_val = value_subscript (tmp, value_as_long (index)); @@ -715,7 +715,7 @@ gdbscm_value_call (SCM self, SCM args) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self, + SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self, SCM_ARG1, FUNC_NAME, _("function (value of TYPE_CODE_FUNC)")); @@ -796,11 +796,11 @@ gdbscm_value_to_bytevector (SCM self) static int is_intlike (struct type *type, int ptr_ok) { - return (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_ENUM - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_CHAR - || (ptr_ok && TYPE_CODE (type) == TYPE_CODE_PTR)); + return (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_ENUM + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_CHAR + || (ptr_ok && type->code () == TYPE_CODE_PTR)); } /* (value->bool <gdb:value>) -> boolean @@ -833,7 +833,7 @@ gdbscm_value_to_bool (SCM self) try { - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) l = value_as_address (value); else l = value_as_long (value); @@ -877,7 +877,7 @@ gdbscm_value_to_integer (SCM self) try { - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) l = value_as_address (value); else l = value_as_long (value); @@ -920,7 +920,7 @@ gdbscm_value_to_real (SCM self) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT, + SCM_ASSERT_TYPE (is_intlike (type, 0) || type->code () == TYPE_CODE_FLT, self, SCM_ARG1, FUNC_NAME, _("number")); try @@ -1113,7 +1113,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest) type = value_type (value); realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_ARRAY: { diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 79c7400..3c2f502 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -740,7 +740,7 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache, store_unsigned_integer (valbuf + 2, 2, byte_order, c); break; case 8: /* long long is now 8 bytes. */ - if (TYPE_CODE (type) == TYPE_CODE_INT) + if (type->code () == TYPE_CODE_INT) { regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr); c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order); @@ -771,7 +771,7 @@ h8300h_extract_return_value (struct type *type, struct regcache *regcache, store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c); break; case 8: /* long long is now 8 bytes. */ - if (TYPE_CODE (type) == TYPE_CODE_INT) + if (type->code () == TYPE_CODE_INT) { regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); store_unsigned_integer (valbuf, 4, byte_order, c); @@ -792,8 +792,8 @@ h8300_use_struct_convention (struct type *value_type) /* Types of 1, 2 or 4 bytes are returned in R0/R1, everything else on the stack. */ - if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT - || TYPE_CODE (value_type) == TYPE_CODE_UNION) + if (value_type->code () == TYPE_CODE_STRUCT + || value_type->code () == TYPE_CODE_UNION) return 1; return !(TYPE_LENGTH (value_type) == 1 || TYPE_LENGTH (value_type) == 2 @@ -805,14 +805,14 @@ h8300h_use_struct_convention (struct type *value_type) { /* Types of 1, 2 or 4 bytes are returned in R0, INT types of 8 bytes are returned in R0/R1, everything else on the stack. */ - if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT - || TYPE_CODE (value_type) == TYPE_CODE_UNION) + if (value_type->code () == TYPE_CODE_STRUCT + || value_type->code () == TYPE_CODE_UNION) return 1; return !(TYPE_LENGTH (value_type) == 1 || TYPE_LENGTH (value_type) == 2 || TYPE_LENGTH (value_type) == 4 || (TYPE_LENGTH (value_type) == 8 - && TYPE_CODE (value_type) == TYPE_CODE_INT)); + && value_type->code () == TYPE_CODE_INT)); } /* Function: store_return_value diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 88abe90..b063cf1 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -763,8 +763,8 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, store_unsigned_integer (param_val, 4, byte_order, struct_end - struct_ptr); } - else if (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_ENUM) + else if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_ENUM) { /* Integer value store, right aligned. "unpack_long" takes care of any sign-extension problems. */ @@ -773,7 +773,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, unpack_long (type, value_contents (arg))); } - else if (TYPE_CODE (type) == TYPE_CODE_FLT) + else if (type->code () == TYPE_CODE_FLT) { /* Floating point value store, right aligned. */ param_len = align_up (TYPE_LENGTH (type), 4); @@ -876,7 +876,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, static int hppa64_integral_or_pointer_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -903,7 +903,7 @@ hppa64_integral_or_pointer_p (const struct type *type) static int hppa64_floating_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: { @@ -1064,8 +1064,8 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* If we are passing a function pointer, make sure we pass a function descriptor instead of the function entry address. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC) + if (type->code () == TYPE_CODE_PTR + && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC) { ULONGEST codeptr, fptr; @@ -1144,7 +1144,7 @@ hppa32_return_value (struct gdbarch *gdbarch, struct value *function, /* The value always lives in the right hand end of the register (or register pair)? */ int b; - int reg = TYPE_CODE (type) == TYPE_CODE_FLT ? HPPA_FP4_REGNUM : 28; + int reg = type->code () == TYPE_CODE_FLT ? HPPA_FP4_REGNUM : 28; int part = TYPE_LENGTH (type) % 4; /* The left hand register contains only part of the value, transfer that first so that the rest can be xfered as entire diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c index a796a85..3908148 100644 --- a/gdb/i386-darwin-tdep.c +++ b/gdb/i386-darwin-tdep.c @@ -109,7 +109,7 @@ darwin_dwarf_signal_frame_p (struct gdbarch *gdbarch, static int i386_m128_p (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + return (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && TYPE_LENGTH (type) == 16); } @@ -124,15 +124,15 @@ i386_darwin_arg_type_alignment (struct type *type) aligned to 8-byte boundaries. 7. [...] The caller aligns 128-bit vectors in the parameter area to 16-byte boundaries. */ - if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) return TYPE_LENGTH (type); /* 4. The caller places all the fields of structures (or unions) with no vector elements in the parameter area. These structures are 4-byte aligned. 5. The caller places structures with vector elements on the stack, 16-byte aligned. */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) { int i; int res = 4; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index fc63635..0f8d9aa 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2633,14 +2633,14 @@ static int i386_16_byte_align_p (struct type *type) { type = check_typedef (type); - if ((TYPE_CODE (type) == TYPE_CODE_DECFLOAT - || (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))) + if ((type->code () == TYPE_CODE_DECFLOAT + || (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))) && TYPE_LENGTH (type) == 16) return 1; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) return i386_16_byte_align_p (TYPE_TARGET_TYPE (type)); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) { int i; for (i = 0; i < TYPE_NFIELDS (type); i++) @@ -2811,7 +2811,7 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type, int len = TYPE_LENGTH (type); gdb_byte buf[I386_MAX_REGISTER_SIZE]; - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) { if (tdep->st0_regnum < 0) { @@ -2861,7 +2861,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int len = TYPE_LENGTH (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) { ULONGEST fstat; gdb_byte buf[I386_MAX_REGISTER_SIZE]; @@ -2938,7 +2938,7 @@ static int i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); int len = TYPE_LENGTH (type); gdb_assert (code == TYPE_CODE_STRUCT @@ -2955,7 +2955,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) { type = check_typedef (TYPE_FIELD_TYPE (type, 0)); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) return (len == 4 || len == 8 || len == 12); } @@ -2973,7 +2973,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION @@ -8398,13 +8398,13 @@ i386_type_align (struct gdbarch *gdbarch, struct type *type) if (gdbarch_ptr_bit (gdbarch) == 32) { - if ((TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_FLT) + if ((type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_FLT) && TYPE_LENGTH (type) > 4) return 4; /* Handle x86's funny long double. */ - if (TYPE_CODE (type) == TYPE_CODE_FLT + if (type->code () == TYPE_CODE_FLT && gdbarch_long_double_bit (gdbarch) == TYPE_LENGTH (type) * 8) return 4; } diff --git a/gdb/i386-windows-tdep.c b/gdb/i386-windows-tdep.c index 4824a9e..7233b1f 100644 --- a/gdb/i386-windows-tdep.c +++ b/gdb/i386-windows-tdep.c @@ -214,15 +214,15 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function, bool thiscall = false; struct type *type = check_typedef (value_type (function)); - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) type = check_typedef (TYPE_TARGET_TYPE (type)); /* read_subroutine_type sets for non-static member functions the artificial flag of the first parameter ('this' pointer). */ - if (TYPE_CODE (type) == TYPE_CODE_METHOD + if (type->code () == TYPE_CODE_METHOD && TYPE_NFIELDS (type) > 0 && TYPE_FIELD_ARTIFICIAL (type, 0) - && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_PTR) + && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR) thiscall = 1; return i386_thiscall_push_dummy_call (gdbarch, function, regcache, bp_addr, diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 3346483..b8c342d 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -332,7 +332,7 @@ i387_convert_register_p (struct gdbarch *gdbarch, int regnum, /* Floating point registers must be converted unless we are accessing them in their hardware type or TYPE is not float. */ if (type == i387_ext_type (gdbarch) - || TYPE_CODE (type) != TYPE_CODE_FLT) + || type->code () != TYPE_CODE_FLT) return 0; else return 1; @@ -355,7 +355,7 @@ i387_register_to_value (struct frame_info *frame, int regnum, gdb_assert (i386_fp_regnum_p (gdbarch, regnum)); /* We only support floating-point values. */ - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) { warning (_("Cannot convert floating-point register value " "to non-floating-point type.")); @@ -387,7 +387,7 @@ i387_value_to_register (struct frame_info *frame, int regnum, gdb_assert (i386_fp_regnum_p (gdbarch, regnum)); /* We only support floating-point values. */ - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) { warning (_("Cannot convert non-floating-point type " "to floating-point register value.")); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 5fa0fad..de6273c 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -330,7 +330,7 @@ ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum, if (group == all_reggroup) return 1; vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); - float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT; + float_p = register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT; raw_p = regnum < NUM_IA64_RAW_REGS; if (group == float_reggroup) return float_p; @@ -1212,7 +1212,7 @@ static int ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type) { return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM - && TYPE_CODE (type) == TYPE_CODE_FLT + && type->code () == TYPE_CODE_FLT && type != ia64_ext_type (gdbarch)); } @@ -3149,9 +3149,9 @@ ia64_use_struct_convention (struct type *type) /* Don't use the struct convention for anything but structure, union, or array types. */ - if (!(TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY)) + if (!(type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY)) return 0; /* HFAs are structures (or arrays) consisting entirely of floating @@ -3173,8 +3173,8 @@ ia64_use_struct_convention (struct type *type) static int ia64_struct_type_p (const struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION); + return (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION); } static void @@ -3320,7 +3320,7 @@ ia64_return_value (struct gdbarch *gdbarch, struct value *function, static int is_float_or_hfa_type_recurse (struct type *t, struct type **etp) { - switch (TYPE_CODE (t)) + switch (t->code ()) { case TYPE_CODE_FLT: if (*etp) @@ -3374,7 +3374,7 @@ is_float_or_hfa_type (struct type *t) static int slot_alignment_is_next_even (struct type *t) { - switch (TYPE_CODE (t)) + switch (t->code ()) { case TYPE_CODE_INT: case TYPE_CODE_FLT: @@ -3699,7 +3699,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if ((nslots & 1) && slot_alignment_is_next_even (type)) nslots++; - if (TYPE_CODE (type) == TYPE_CODE_FUNC) + if (type->code () == TYPE_CODE_FUNC) nfuncargs++; nslots += (len + 7) / 8; @@ -3740,9 +3740,9 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, len = TYPE_LENGTH (type); /* Special handling for function parameters. */ - if (len == 8 - && TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC) + if (len == 8 + && type->code () == TYPE_CODE_PTR + && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC) { gdb_byte val_buf[8]; ULONGEST faddr = extract_unsigned_integer (value_contents (arg), diff --git a/gdb/infcall.c b/gdb/infcall.c index b13c781..818b6cb 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -169,7 +169,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, saved by the called function. */ arg = value_coerce_to_target (arg); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_REF: case TYPE_CODE_RVALUE_REF: @@ -184,7 +184,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, if the value was not previously in memory - in some cases we should clearly be allowing this, but how? */ new_value = value_cast (TYPE_TARGET_TYPE (type), arg); - new_value = value_ref (new_value, TYPE_CODE (type)); + new_value = value_ref (new_value, type->code ()); return new_value; } case TYPE_CODE_INT: @@ -260,20 +260,20 @@ find_function_addr (struct value *function, part of it. */ /* Determine address to call. */ - if (TYPE_CODE (ftype) == TYPE_CODE_FUNC - || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + if (ftype->code () == TYPE_CODE_FUNC + || ftype->code () == TYPE_CODE_METHOD) funaddr = value_address (function); - else if (TYPE_CODE (ftype) == TYPE_CODE_PTR) + else if (ftype->code () == TYPE_CODE_PTR) { funaddr = value_as_address (function); ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); - if (TYPE_CODE (ftype) == TYPE_CODE_FUNC - || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + if (ftype->code () == TYPE_CODE_FUNC + || ftype->code () == TYPE_CODE_METHOD) funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, current_top_target ()); } - if (TYPE_CODE (ftype) == TYPE_CODE_FUNC - || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + if (ftype->code () == TYPE_CODE_FUNC + || ftype->code () == TYPE_CODE_METHOD) { if (TYPE_GNU_IFUNC (ftype)) { @@ -303,7 +303,7 @@ find_function_addr (struct value *function, else value_type = TYPE_TARGET_TYPE (ftype); } - else if (TYPE_CODE (ftype) == TYPE_CODE_INT) + else if (ftype->code () == TYPE_CODE_INT) { /* Handle the case of functions lacking debugging info. Their values are characters since their addresses are char. */ @@ -438,7 +438,7 @@ get_call_return_value (struct call_return_meta_info *ri) thread_info *thr = inferior_thread (); bool stack_temporaries = thread_stack_temporaries_enabled_p (thr); - if (TYPE_CODE (ri->value_type) == TYPE_CODE_VOID) + if (ri->value_type->code () == TYPE_CODE_VOID) retval = allocate_value (ri->value_type); else if (ri->struct_return_p) { @@ -1025,7 +1025,7 @@ call_function_by_hand_dummy (struct value *function, /* FIXME drow/2002-05-31: Should just always mark methods as prototyped. Can we respect TYPE_VARARGS? Probably not. */ - if (TYPE_CODE (ftype) == TYPE_CODE_METHOD) + if (ftype->code () == TYPE_CODE_METHOD) prototyped = 1; if (TYPE_TARGET_TYPE (ftype) == NULL && TYPE_NFIELDS (ftype) == 0 && default_return_type != NULL) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 9bbb413..8b01f45 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1589,7 +1589,7 @@ get_return_value (struct value *function, struct type *value_type) struct value *value; value_type = check_typedef (value_type); - gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID); + gdb_assert (value_type->code () != TYPE_CODE_VOID); /* FIXME: 2003-09-27: When returning from a nested inferior function call, it's possible (with no help from the architecture vector) @@ -1680,7 +1680,7 @@ void print_return_value (struct ui_out *uiout, struct return_value_info *rv) { if (rv->type == NULL - || TYPE_CODE (check_typedef (rv->type)) == TYPE_CODE_VOID) + || check_typedef (rv->type)->code () == TYPE_CODE_VOID) return; try @@ -1744,7 +1744,7 @@ finish_command_fsm::should_stop (struct thread_info *tp) internal_error (__FILE__, __LINE__, _("finish_command: function has no target type")); - if (TYPE_CODE (check_typedef (rv->type)) != TYPE_CODE_VOID) + if (check_typedef (rv->type)->code () != TYPE_CODE_VOID) { struct value *func; @@ -2250,8 +2250,8 @@ default_print_one_register_info (struct ui_file *file, /* If virtual format is floating, print it that way, and in raw hex. */ - if (TYPE_CODE (regtype) == TYPE_CODE_FLT - || TYPE_CODE (regtype) == TYPE_CODE_DECFLOAT) + if (regtype->code () == TYPE_CODE_FLT + || regtype->code () == TYPE_CODE_DECFLOAT) { struct value_print_options opts; const gdb_byte *valaddr = value_contents_for_printing (val); diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index 7864d81..1767a45 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -89,7 +89,7 @@ iq2000_pointer_to_address (struct gdbarch *gdbarch, struct type * type, const gdb_byte * buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); + enum type_code target = TYPE_TARGET_TYPE (type)->code (); CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); @@ -109,7 +109,7 @@ iq2000_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); + enum type_code target = TYPE_TARGET_TYPE (type)->code (); if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD) addr = insn_ptr_from_addr (addr); @@ -504,8 +504,8 @@ iq2000_store_return_value (struct type *type, struct regcache *regcache, static int iq2000_use_struct_convention (struct type *type) { - return ((TYPE_CODE (type) == TYPE_CODE_STRUCT) - || (TYPE_CODE (type) == TYPE_CODE_UNION)) + return ((type->code () == TYPE_CODE_STRUCT) + || (type->code () == TYPE_CODE_UNION)) && TYPE_LENGTH (type) > 8; } @@ -597,11 +597,11 @@ iq2000_pass_8bytetype_by_address (struct type *type) struct type *ftype; /* Skip typedefs. */ - while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + while (type->code () == TYPE_CODE_TYPEDEF) type = TYPE_TARGET_TYPE (type); /* Non-struct and non-union types are always passed by value. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) return 0; /* Structs with more than 1 field are always passed by address. */ if (TYPE_NFIELDS (type) != 1) @@ -612,11 +612,11 @@ iq2000_pass_8bytetype_by_address (struct type *type) if (TYPE_LENGTH (ftype) != 8) return 1; /* Skip typedefs of field type. */ - while (TYPE_CODE (ftype) == TYPE_CODE_TYPEDEF) + while (ftype->code () == TYPE_CODE_TYPEDEF) ftype = TYPE_TARGET_TYPE (ftype); /* If field is int or float, pass by value. */ - if (TYPE_CODE (ftype) == TYPE_CODE_FLT - || TYPE_CODE (ftype) == TYPE_CODE_INT) + if (ftype->code () == TYPE_CODE_FLT + || ftype->code () == TYPE_CODE_INT) return 0; /* Everything else, pass by address. */ return 1; diff --git a/gdb/language.c b/gdb/language.c index 769b329..a7ecb79 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -410,7 +410,7 @@ language_info (int quietly) int pointer_type (struct type *type) { - return TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type); + return type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type); } @@ -710,12 +710,12 @@ bool default_is_string_type_p (struct type *type) { type = check_typedef (type); - while (TYPE_CODE (type) == TYPE_CODE_REF) + while (type->code () == TYPE_CODE_REF) { type = TYPE_TARGET_TYPE (type); type = check_typedef (type); } - return (TYPE_CODE (type) == TYPE_CODE_STRING); + return (type->code () == TYPE_CODE_STRING); } /* See language.h. */ @@ -981,7 +981,7 @@ language_bool_type (const struct language_defn *la, { struct type *type = SYMBOL_TYPE (sym); - if (type && TYPE_CODE (type) == TYPE_CODE_BOOL) + if (type && type->code () == TYPE_CODE_BOOL) return type; } } diff --git a/gdb/linespec.c b/gdb/linespec.c index 1f28987..1e70cdb 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3491,9 +3491,9 @@ decode_compound_collector::operator () (block_symbol *bsym) t = SYMBOL_TYPE (sym); t = check_typedef (t); - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION - && TYPE_CODE (t) != TYPE_CODE_NAMESPACE) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION + && t->code () != TYPE_CODE_NAMESPACE) return true; /* Continue iterating. */ slot = htab_find_slot (m_unique_syms, sym, INSERT); @@ -4164,7 +4164,7 @@ linespec_parse_variable (struct linespec_state *self, const char *variable) sscanf ((variable[1] == '$') ? variable + 2 : variable + 1, "%d", &index); val_history = access_value_history ((variable[1] == '$') ? -index : index); - if (TYPE_CODE (value_type (val_history)) != TYPE_CODE_INT) + if (value_type (val_history)->code () != TYPE_CODE_INT) error (_("History values used in line " "specs must have integer values.")); offset.offset = value_as_long (val_history); diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index f2c3fea..6b5bb15 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -258,7 +258,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, ULONGEST val; /* Promote small integer types to int. */ - switch (TYPE_CODE (arg_type)) + switch (arg_type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -309,15 +309,15 @@ lm32_extract_return_value (struct type *type, struct regcache *regcache, ULONGEST l; CORE_ADDR return_buffer; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION + && type->code () != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4) { /* Return value is returned in a single register. */ regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l); store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, l); } - else if ((TYPE_CODE (type) == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8)) + else if ((type->code () == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8)) { /* 64-bit values are returned in a register pair. */ regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l); @@ -368,7 +368,7 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - enum type_code code = TYPE_CODE (valtype); + enum type_code code = valtype->code (); if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index af3cf3a..7f0255b 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -181,15 +181,15 @@ static bool m2_is_string_type_p (struct type *type) { type = check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0) { struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); if (TYPE_LENGTH (elttype) == 1 - && (TYPE_CODE (elttype) == TYPE_CODE_INT - || TYPE_CODE (elttype) == TYPE_CODE_CHAR)) + && (elttype->code () == TYPE_CODE_INT + || elttype->code () == TYPE_CODE_CHAR)) return true; } @@ -251,7 +251,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, { struct value *temp = arg1; type = TYPE_FIELD_TYPE (type, 0); - if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR)) + if (type == NULL || (type->code () != TYPE_CODE_PTR)) { warning (_("internal error: unbounded " "array structure is unknown")); @@ -269,7 +269,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, return value_ind (value_ptradd (arg1, value_as_long (arg2))); } else - if (TYPE_CODE (type) != TYPE_CODE_ARRAY) + if (type->code () != TYPE_CODE_ARRAY) { if (TYPE_NAME (type)) error (_("cannot subscript something of type `%s'"), diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index a4a7689..1f1300c 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -86,7 +86,7 @@ m2_print_type (struct type *type, const char *varstring, return; } - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_SET: m2_short_set(type, stream, show, level); @@ -282,7 +282,7 @@ m2_procedure (struct type *type, struct ui_file *stream, fprintf_filtered (stream, "PROCEDURE "); m2_type_name (type, stream); if (TYPE_TARGET_TYPE (type) == NULL - || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { int i, len = TYPE_NFIELDS (type); @@ -341,7 +341,7 @@ m2_is_long_set (struct type *type) int len, i; struct type *range; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { /* check if all fields of the RECORD are consecutive sets. */ @@ -351,7 +351,7 @@ m2_is_long_set (struct type *type) { if (TYPE_FIELD_TYPE (type, i) == NULL) return 0; - if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) != TYPE_CODE_SET) + if (TYPE_FIELD_TYPE (type, i)->code () != TYPE_CODE_SET) return 0; if (TYPE_FIELD_NAME (type, i) != NULL && (strcmp (TYPE_FIELD_NAME (type, i), "") != 0)) @@ -376,7 +376,7 @@ static int m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) { type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_CHAR: if (TYPE_LENGTH (type) < sizeof (LONGEST)) @@ -407,7 +407,7 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type) LONGEST l1, l2; LONGEST h1, h2; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { len = TYPE_NFIELDS (type); i = TYPE_N_BASECLASSES (type); @@ -482,7 +482,7 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level, int m2_is_unbounded_array (struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { /* * check if we have a structure with exactly two fields named @@ -496,7 +496,7 @@ m2_is_unbounded_array (struct type *type) return 0; if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0) return 0; - if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) != TYPE_CODE_PTR) + if (TYPE_FIELD_TYPE (type, 0)->code () != TYPE_CODE_PTR) return 0; return 1; } @@ -542,9 +542,9 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show, wrap_here (" "); if (show < 0) { - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) fprintf_filtered (stream, "RECORD ... END "); - else if (TYPE_CODE (type) == TYPE_CODE_UNION) + else if (type->code () == TYPE_CODE_UNION) fprintf_filtered (stream, "CASE ... END "); } else if (show > 0) @@ -552,9 +552,9 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show, int i; int len = TYPE_NFIELDS (type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) fprintf_filtered (stream, "RECORD\n"); - else if (TYPE_CODE (type) == TYPE_CODE_UNION) + else if (type->code () == TYPE_CODE_UNION) /* i18n: Do not translate "CASE" and "OF". */ fprintf_filtered (stream, _("CASE <variant> OF\n")); diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index e210b5e..f016611 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -49,7 +49,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high) { int len, i; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { len = TYPE_NFIELDS (type); i = TYPE_N_BASECLASSES (type); @@ -191,7 +191,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); int want_space = 0; - if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) + if (elttype->code () == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ print_function_pointer_address (options, gdbarch, addr, stream); @@ -209,7 +209,7 @@ print_unpacked_pointer (struct type *type, pointed to, unless pointer is null. */ if (TYPE_LENGTH (elttype) == 1 - && TYPE_CODE (elttype) == TYPE_CODE_INT + && elttype->code () == TYPE_CODE_INT && (options->format == 0 || options->format == 's') && addr != 0) { @@ -237,7 +237,7 @@ print_variable_at_address (struct type *type, fputs_filtered (paddress (gdbarch, addr), stream); fprintf_filtered (stream, "] : "); - if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) + if (elttype->code () != TYPE_CODE_UNDEF) { struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr)); @@ -267,9 +267,9 @@ m2_print_array_contents (struct value *val, { /* For an array of chars, print with string syntax. */ if (TYPE_LENGTH (type) == 1 && - ((TYPE_CODE (type) == TYPE_CODE_INT) + ((type->code () == TYPE_CODE_INT) || ((current_language->la_language == language_m2) - && (TYPE_CODE (type) == TYPE_CODE_CHAR))) + && (type->code () == TYPE_CODE_CHAR))) && (options->format == 0 || options->format == 's')) val_print_string (type, NULL, value_address (val), len+1, stream, options); @@ -309,7 +309,7 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse, const CORE_ADDR address = value_address (val); struct type *type = check_typedef (value_type (val)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0) @@ -318,9 +318,9 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse, len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype); /* For an array of chars, print with string syntax. */ if (TYPE_LENGTH (elttype) == 1 && - ((TYPE_CODE (elttype) == TYPE_CODE_INT) + ((elttype->code () == TYPE_CODE_INT) || ((current_language->la_language == language_m2) - && (TYPE_CODE (elttype) == TYPE_CODE_CHAR))) + && (elttype->code () == TYPE_CODE_CHAR))) && (options->format == 0 || options->format == 's')) { /* If requested, look for the first null char and only print diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 585fa33..a49937a 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -1986,7 +1986,7 @@ static const struct frame_unwind m32c_unwind = { static int m32c_reg_arg_type (struct type *type) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); return (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM @@ -2021,11 +2021,11 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct type *func_type = value_type (function); /* Dereference function pointer types. */ - if (TYPE_CODE (func_type) == TYPE_CODE_PTR) + if (func_type->code () == TYPE_CODE_PTR) func_type = TYPE_TARGET_TYPE (func_type); - gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC || - TYPE_CODE (func_type) == TYPE_CODE_METHOD); + gdb_assert (func_type->code () == TYPE_CODE_FUNC || + func_type->code () == TYPE_CODE_METHOD); #if 0 /* The ABI description in gcc/config/m32c/m32c.abi says that @@ -2153,7 +2153,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function, static int m32c_return_by_passed_buf (struct type *type) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); return (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION); @@ -2399,9 +2399,9 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum type_code target_code; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)); + gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)); - target_code = TYPE_CODE (TYPE_TARGET_TYPE (type)); + target_code = TYPE_TARGET_TYPE (type)->code (); if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD) { @@ -2478,11 +2478,11 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch, CORE_ADDR ptr; enum type_code target_code; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)); + gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)); ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); - target_code = TYPE_CODE (TYPE_TARGET_TYPE (type)); + target_code = TYPE_TARGET_TYPE (type)->code (); if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD) { diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 60e5387..011a0d2 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -690,7 +690,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++) { type = value_type (args[argnum]); - typecode = TYPE_CODE (type); + typecode = type->code (); len = TYPE_LENGTH (type); memset (valbuf, 0, sizeof (valbuf)); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index fb3b18a..84d475b 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1290,9 +1290,9 @@ m68hc11_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY + if (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY || TYPE_LENGTH (valtype) > 4) return RETURN_VALUE_STRUCT_CONVENTION; else diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 5ed5087..46a0f09 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -191,7 +191,7 @@ m68k_convert_register_p (struct gdbarch *gdbarch, return 0; return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7 /* We only support floating-point values. */ - && TYPE_CODE (type) == TYPE_CODE_FLT + && type->code () == TYPE_CODE_FLT && type != register_type (gdbarch, M68K_FP0_REGNUM)); } @@ -207,7 +207,7 @@ m68k_register_to_value (struct frame_info *frame, int regnum, gdb_byte from[M68K_MAX_REGISTER_SIZE]; struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + gdb_assert (type->code () == TYPE_CODE_FLT); /* Convert to TYPE. */ if (!get_frame_register_bytes (frame, regnum, 0, @@ -232,7 +232,7 @@ m68k_value_to_register (struct frame_info *frame, int regnum, M68K_FP0_REGNUM); /* We only support floating-point values. */ - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) { warning (_("Cannot convert non-floating-point type " "to floating-point register value.")); @@ -308,13 +308,13 @@ m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache, struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT) + if (tdep->float_return && type->code () == TYPE_CODE_FLT) { struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM); regcache->raw_read (M68K_FP0_REGNUM, buf); target_float_convert (buf, fpreg_type, valbuf, type); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) + else if (type->code () == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) regcache->raw_read (M68K_A0_REGNUM, valbuf); else m68k_extract_return_value (type, regcache, valbuf); @@ -347,14 +347,14 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT) + if (tdep->float_return && type->code () == TYPE_CODE_FLT) { struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM); gdb_byte buf[M68K_MAX_REGISTER_SIZE]; target_float_convert (valbuf, type, buf, fpreg_type); regcache->raw_write (M68K_FP0_REGNUM, buf); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) + else if (type->code () == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) { regcache->raw_write (M68K_A0_REGNUM, valbuf); regcache->raw_write (M68K_D0_REGNUM, valbuf); @@ -371,7 +371,7 @@ static int m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); int len = TYPE_LENGTH (type); gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION @@ -394,7 +394,7 @@ m68k_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); /* GCC returns a `long double' in memory too. */ if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION @@ -430,7 +430,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION || code == TYPE_CODE_COMPLEX) @@ -511,9 +511,9 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Non-scalars bigger than 4 bytes are left aligned, others are right aligned. */ - if ((TYPE_CODE (value_type) == TYPE_CODE_STRUCT - || TYPE_CODE (value_type) == TYPE_CODE_UNION - || TYPE_CODE (value_type) == TYPE_CODE_ARRAY) + if ((value_type->code () == TYPE_CODE_STRUCT + || value_type->code () == TYPE_CODE_UNION + || value_type->code () == TYPE_CODE_ARRAY) && len > 4) offset = 0; else diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 621069e..eab52c7 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -747,7 +747,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, { t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name); if (strcmp (name, "malloc") == 0 - && TYPE_CODE (t) == TYPE_CODE_VOID) + && t->code () == TYPE_CODE_VOID) { /* I don't know why, but, at least under Alpha GNU/Linux, when linking against a malloc without debugging @@ -1298,11 +1298,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* Incomplete definitions of structs should not get a name. */ if (TYPE_NAME (SYMBOL_TYPE (s)) == NULL && (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0 - || (TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_STRUCT - && TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_UNION))) + || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT + && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION))) { - if (TYPE_CODE (SYMBOL_TYPE (s)) == TYPE_CODE_PTR - || TYPE_CODE (SYMBOL_TYPE (s)) == TYPE_CODE_FUNC) + if (SYMBOL_TYPE (s)->code () == TYPE_CODE_PTR + || SYMBOL_TYPE (s)->code () == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to foo" or "function returning foo", we better not set @@ -1639,16 +1639,16 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, /* DEC c89 produces cross references to qualified aggregate types, dereference them. */ - while (TYPE_CODE (tp) == TYPE_CODE_PTR - || TYPE_CODE (tp) == TYPE_CODE_ARRAY) + while (tp->code () == TYPE_CODE_PTR + || tp->code () == TYPE_CODE_ARRAY) tp = TYPE_TARGET_TYPE (tp); /* Make sure that TYPE_CODE(tp) has an expected type code. Any type may be returned from cross_ref if file indirect entries are corrupted. */ - if (TYPE_CODE (tp) != TYPE_CODE_STRUCT - && TYPE_CODE (tp) != TYPE_CODE_UNION - && TYPE_CODE (tp) != TYPE_CODE_ENUM) + if (tp->code () != TYPE_CODE_STRUCT + && tp->code () != TYPE_CODE_UNION + && tp->code () != TYPE_CODE_ENUM) { unexpected_type_code_complaint (sym_name); } @@ -1658,15 +1658,15 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, exception is if we guessed wrong re struct/union/enum. But for struct vs. union a wrong guess is harmless, so don't complain(). */ - if ((TYPE_CODE (tp) == TYPE_CODE_ENUM + if ((tp->code () == TYPE_CODE_ENUM && type_code != TYPE_CODE_ENUM) - || (TYPE_CODE (tp) != TYPE_CODE_ENUM + || (tp->code () != TYPE_CODE_ENUM && type_code == TYPE_CODE_ENUM)) { bad_tag_guess_complaint (sym_name); } - if (TYPE_CODE (tp) != type_code) + if (tp->code () != type_code) { tp->set_code (type_code); } @@ -1698,7 +1698,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, /* Make sure that TYPE_CODE(tp) has an expected type code. Any type may be returned from cross_ref if file indirect entries are corrupted. */ - if (TYPE_CODE (tp) != TYPE_CODE_RANGE) + if (tp->code () != TYPE_CODE_RANGE) { unexpected_type_code_complaint (sym_name); } @@ -1706,7 +1706,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, { /* Usually, TYPE_CODE(tp) is already type_code. The main exception is if we guessed wrong re struct/union/enum. */ - if (TYPE_CODE (tp) != type_code) + if (tp->code () != type_code) { bad_tag_guess_complaint (sym_name); tp->set_code (type_code); @@ -1831,7 +1831,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend, /* The bounds type should be an integer type, but might be anything else due to corrupt aux entries. */ - if (TYPE_CODE (indx) != TYPE_CODE_INT) + if (indx->code () != TYPE_CODE_INT) { complaint (_("illegal array index type for %s, assuming int"), sym_name); @@ -2038,7 +2038,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, if (processing_gcc_compilation == 0 && found_ecoff_debugging_info == 0 - && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s))) == TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (SYMBOL_TYPE (s))->code () == TYPE_CODE_VOID) SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->nodebug_text_symbol; } diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 112cc28..ef09109 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -650,9 +650,9 @@ list_args_or_locals (const frame_print_options &fp_opts, { case PRINT_SIMPLE_VALUES: type = check_typedef (sym2->type); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) { case PRINT_ALL_VALUES: if (SYMBOL_IS_ARGUMENT (sym)) diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index e73abfe..da5bf2d 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -340,9 +340,9 @@ mi_print_value_p (struct varobj *var, enum print_values print_values) /* For PRINT_SIMPLE_VALUES, only print the value if it has a type and that type is not a compound type. */ - return (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION); + return (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION); } } diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 9c6323e..55bb777 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2458,9 +2458,9 @@ print_variable_or_computed (const char *expression, enum print_values values) type = check_typedef (value_type (val)); type_print (value_type (val), "", &stb, -1); uiout->field_stream ("type", stb); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) { struct value_print_options opts; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index e3d8581..df59f41 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -687,7 +687,7 @@ mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum, if (reggroup == all_reggroup) return pseudo; vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); - float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT; + float_p = register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT; /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs (gdbarch), as not all architectures are multi-arch. */ raw_p = rawnum < gdbarch_num_regs (gdbarch); @@ -889,7 +889,7 @@ mips_convert_register_float_case_p (struct gdbarch *gdbarch, int regnum, return (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG && register_size (gdbarch, regnum) == 4 && mips_float_register_p (gdbarch, regnum) - && TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8); + && type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8); } /* This predicate tests for the case of a value of less than 8 @@ -4408,7 +4408,7 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode, && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) && TYPE_NFIELDS (arg_type) == 1 - && TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (arg_type, 0))) + && check_typedef (TYPE_FIELD_TYPE (arg_type, 0))->code () == TYPE_CODE_FLT)) && MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE); } @@ -4419,7 +4419,7 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode, static int mips_type_needs_double_align (struct type *type) { - enum type_code typecode = TYPE_CODE (type); + enum type_code typecode = type->code (); if (typecode == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8) return 1; @@ -4562,7 +4562,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); if (mips_debug) fprintf_unfiltered (gdb_stdlog, @@ -4782,17 +4782,17 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function, /* Floating point type? */ if (tdep->mips_fpu_type != MIPS_FPU_NONE) { - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) fp_return_type = 1; /* Structs with a single field of float type are returned in a floating point register. */ - if ((TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if ((type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) && TYPE_NFIELDS (type) == 1) { struct type *fieldtype = TYPE_FIELD_TYPE (type, 0); - if (TYPE_CODE (check_typedef (fieldtype)) == TYPE_CODE_FLT) + if (check_typedef (fieldtype)->code () == TYPE_CODE_FLT) fp_return_type = 1; } } @@ -4841,7 +4841,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, { int i; - if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT) + if (arg_type->code () != TYPE_CODE_STRUCT) return 0; if (MIPS_FPU_TYPE (gdbarch) != MIPS_FPU_DOUBLE) @@ -4873,7 +4873,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, continue; /* If this is our special aligned double, we can stop. */ - if (TYPE_CODE (field_type) == TYPE_CODE_FLT + if (field_type->code () == TYPE_CODE_FLT && TYPE_LENGTH (field_type) == MIPS64_REGSIZE) return 1; @@ -4952,7 +4952,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); if (mips_debug) fprintf_unfiltered (gdb_stdlog, @@ -5189,7 +5189,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, if (TYPE_LENGTH (type) > 2 * MIPS64_REGSIZE) return RETURN_VALUE_STRUCT_CONVENTION; - else if (TYPE_CODE (type) == TYPE_CODE_FLT + else if (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 16 && tdep->mips_fpu_type != MIPS_FPU_NONE) { @@ -5211,7 +5211,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, writebuf ? writebuf + 8 : writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } - else if (TYPE_CODE (type) == TYPE_CODE_FLT + else if (type->code () == TYPE_CODE_FLT && tdep->mips_fpu_type != MIPS_FPU_NONE) { /* A single or double floating-point value that fits in FP0. */ @@ -5225,16 +5225,16 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, readbuf, writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT + else if (type->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) <= 2 && TYPE_NFIELDS (type) >= 1 && ((TYPE_NFIELDS (type) == 1 - && (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) + && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code () == TYPE_CODE_FLT)) || (TYPE_NFIELDS (type) == 2 - && (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) + && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code () == TYPE_CODE_FLT) - && (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 1))) + && (check_typedef (TYPE_FIELD_TYPE (type, 1))->code () == TYPE_CODE_FLT)))) { /* A struct that contains one or two floats. Each value is part @@ -5276,9 +5276,9 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, } return RETURN_VALUE_REGISTER_CONVENTION; } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + else if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY) { /* A composite type. Extract the left justified value, regardless of the byte order. I.e. DO NOT USE @@ -5419,7 +5419,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); if (mips_debug) fprintf_unfiltered (gdb_stdlog, @@ -5663,11 +5663,11 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function, enum mips_fval_reg fval_reg; fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY) return RETURN_VALUE_STRUCT_CONVENTION; - else if (TYPE_CODE (type) == TYPE_CODE_FLT + else if (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 4 && tdep->mips_fpu_type != MIPS_FPU_NONE) { /* A single-precision floating-point value. If reading in or copying, @@ -5704,7 +5704,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function, readbuf, writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } - else if (TYPE_CODE (type) == TYPE_CODE_FLT + else if (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8 && tdep->mips_fpu_type != MIPS_FPU_NONE) { /* A double-precision floating-point value. If reading in or copying, @@ -5778,7 +5778,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function, return RETURN_VALUE_REGISTER_CONVENTION; } #if 0 - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT + else if (type->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) <= 2 && TYPE_NFIELDS (type) >= 1 && ((TYPE_NFIELDS (type) == 1 @@ -5814,8 +5814,8 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function, } #endif #if 0 - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + else if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) { /* A structure or union. Extract the left justified value, regardless of the byte order. I.e. DO NOT USE @@ -5941,7 +5941,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); if (mips_debug) fprintf_unfiltered (gdb_stdlog, @@ -6109,11 +6109,11 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function, enum mips_fval_reg fval_reg; fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY) return RETURN_VALUE_STRUCT_CONVENTION; - else if (fp_register_arg_p (gdbarch, TYPE_CODE (type), type)) + else if (fp_register_arg_p (gdbarch, type->code (), type)) { /* A floating-point value. If reading in or copying, then we get it from/put it to FP0 for standard MIPS code or GPR2 for MIPS16 code. diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 8e48724..9866048 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -88,7 +88,7 @@ mn10300_type_align (struct type *type) { int i, align = 1; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_ENUM: @@ -137,7 +137,7 @@ mn10300_use_struct_convention (struct type *type) if (TYPE_LENGTH (type) > 8) return 1; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -174,7 +174,7 @@ mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type, int len = TYPE_LENGTH (type); int reg, regsz; - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) reg = 4; else reg = 0; @@ -202,7 +202,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type, int len = TYPE_LENGTH (type); int reg, regsz; - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) reg = 4; else reg = 0; @@ -1208,7 +1208,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, for (argnum = 0; argnum < nargs; argnum++) { /* FIXME what about structs? Unions? */ - if (TYPE_CODE (value_type (*args)) == TYPE_CODE_STRUCT + if (value_type (*args)->code () == TYPE_CODE_STRUCT && TYPE_LENGTH (value_type (*args)) > 8) { /* Change to pointer-to-type. */ diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 8859766..9119b5f 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -570,8 +570,8 @@ msp430_return_value (struct gdbarch *gdbarch, int code_model = gdbarch_tdep (gdbarch)->code_model; if (TYPE_LENGTH (valtype) > 8 - || TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION) + || valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION) return RETURN_VALUE_STRUCT_CONVENTION; if (readbuf) @@ -585,7 +585,7 @@ msp430_return_value (struct gdbarch *gdbarch, int size = 2; if (code_model == MSP_LARGE_CODE_MODEL - && TYPE_CODE (valtype) == TYPE_CODE_PTR) + && valtype->code () == TYPE_CODE_PTR) { size = 4; } @@ -609,7 +609,7 @@ msp430_return_value (struct gdbarch *gdbarch, int size = 2; if (code_model == MSP_LARGE_CODE_MODEL - && TYPE_CODE (valtype) == TYPE_CODE_PTR) + && valtype->code () == TYPE_CODE_PTR) { size = 4; } @@ -652,12 +652,12 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct type *func_type = value_type (function); /* Dereference function pointer types. */ - while (TYPE_CODE (func_type) == TYPE_CODE_PTR) + while (func_type->code () == TYPE_CODE_PTR) func_type = TYPE_TARGET_TYPE (func_type); /* The end result had better be a function or a method. */ - gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC - || TYPE_CODE (func_type) == TYPE_CODE_METHOD); + gdb_assert (func_type->code () == TYPE_CODE_FUNC + || func_type->code () == TYPE_CODE_METHOD); /* We make two passes; the first does the stack allocation, the second actually stores the arguments. */ @@ -691,8 +691,8 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function, current_arg_on_stack = 0; - if (TYPE_CODE (arg_type) == TYPE_CODE_STRUCT - || TYPE_CODE (arg_type) == TYPE_CODE_UNION) + if (arg_type->code () == TYPE_CODE_STRUCT + || arg_type->code () == TYPE_CODE_UNION) { /* Aggregates of any size are passed by reference. */ store_unsigned_integer (struct_addr_buf, 4, byte_order, @@ -723,10 +723,10 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int size = 2; if (code_model == MSP_LARGE_CODE_MODEL - && (TYPE_CODE (arg_type) == TYPE_CODE_PTR + && (arg_type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (arg_type) - || TYPE_CODE (arg_type) == TYPE_CODE_STRUCT - || TYPE_CODE (arg_type) == TYPE_CODE_UNION)) + || arg_type->code () == TYPE_CODE_STRUCT + || arg_type->code () == TYPE_CODE_UNION)) { /* When using the large memory model, pointer, reference, struct, and union arguments are diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index 220ad1e..d4d07c0 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -1402,7 +1402,7 @@ nds32_check_calling_use_fpr (struct type *type) while (1) { t = check_typedef (t); - typecode = TYPE_CODE (t); + typecode = t->code (); if (typecode != TYPE_CODE_STRUCT) break; else if (TYPE_NFIELDS (t) != 1) diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 02cdaea..acc2873 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -2236,7 +2236,7 @@ nios2_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) static ULONGEST nios2_type_align (struct gdbarch *gdbarch, struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_FUNC: diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 1c7ec56..d724433 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -95,7 +95,7 @@ lookup_struct_typedef (const char *name, const struct block *block, int noerr) else error (_("No struct type named %s."), name); } - if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT) + if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT) { if (noerr) return 0; diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index a4fdc5a..0cd3501 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -96,9 +96,9 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code, { LONGEST lowb, highb; - if (TYPE_CODE (types[i]) == TYPE_CODE_ARRAY && TYPE_VECTOR (types[i]) + if (types[i]->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (types[i]) && get_array_bounds (types[i], &lowb, &highb) - && TYPE_CODE (TYPE_TARGET_TYPE (types[i])) == code + && TYPE_TARGET_TYPE (types[i])->code () == code && TYPE_UNSIGNED (TYPE_TARGET_TYPE (types[i])) == flag_unsigned && TYPE_LENGTH (TYPE_TARGET_TYPE (types[i])) == el_length && TYPE_LENGTH (types[i]) == length @@ -177,7 +177,7 @@ lval_func_read (struct value *v) LONGEST lowb = 0; LONGEST highb = 0; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && !get_array_bounds (type, &lowb, &highb)) error (_("Could not determine the vector bounds")); @@ -206,7 +206,7 @@ lval_func_write (struct value *v, struct value *fromval) LONGEST lowb = 0; LONGEST highb = 0; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && !get_array_bounds (type, &lowb, &highb)) error (_("Could not determine the vector bounds")); @@ -336,7 +336,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside, /* Multiple components of the vector are requested which means the resulting type is a vector as well. */ struct type *dst_type = - lookup_opencl_vector_type (gdbarch, TYPE_CODE (elm_type), + lookup_opencl_vector_type (gdbarch, elm_type->code (), TYPE_LENGTH (elm_type), TYPE_UNSIGNED (elm_type), n); @@ -497,7 +497,7 @@ opencl_logical_not (struct expression *exp, struct value *arg) struct type *rettype; struct value *ret; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) { struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); LONGEST lowb, highb; @@ -586,8 +586,8 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, type1 = check_typedef (value_type (val1)); type2 = check_typedef (value_type (val2)); - t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)); - t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)); + t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)); + t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)); if (!t1_is_vec || !t2_is_vec) error (_("Vector operations are not supported on scalar types")); @@ -600,7 +600,7 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, error (_("Could not determine the vector bounds")); /* Check whether the vector types are compatible. */ - if (TYPE_CODE (eltype1) != TYPE_CODE (eltype2) + if (eltype1->code () != eltype2->code () || TYPE_LENGTH (eltype1) != TYPE_LENGTH (eltype2) || TYPE_UNSIGNED (eltype1) != TYPE_UNSIGNED (eltype2) || lowb1 != lowb2 || highb1 != highb2) @@ -647,11 +647,11 @@ opencl_value_cast (struct type *type, struct value *arg) to_type = check_typedef (type); - code1 = TYPE_CODE (to_type); - code2 = TYPE_CODE (check_typedef (value_type (arg))); + code1 = to_type->code (); + code2 = check_typedef (value_type (arg))->code (); if (code2 == TYPE_CODE_REF) - code2 = TYPE_CODE (check_typedef (value_type (coerce_ref (arg)))); + code2 = check_typedef (value_type (coerce_ref(arg)))->code (); scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL || code2 == TYPE_CODE_CHAR || code2 == TYPE_CODE_FLT @@ -687,9 +687,9 @@ opencl_relop (struct expression *exp, struct value *arg1, struct value *arg2, struct value *val; struct type *type1 = check_typedef (value_type (arg1)); struct type *type2 = check_typedef (value_type (arg2)); - int t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY + int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)); - int t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY + int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)); if (!t1_is_vec && !t2_is_vec) @@ -710,7 +710,7 @@ opencl_relop (struct expression *exp, struct value *arg1, struct value *arg2, struct value **v = t1_is_vec ? &arg2 : &arg1; struct type *t = t1_is_vec ? type2 : type1; - if (TYPE_CODE (t) != TYPE_CODE_FLT && !is_integral_type (t)) + if (t->code () != TYPE_CODE_FLT && !is_integral_type (t)) error (_("Argument to operation not a number or boolean.")); *v = opencl_value_cast (t1_is_vec ? type1 : type2, *v); @@ -832,8 +832,8 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - if ((TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) - || (TYPE_CODE (type2) == TYPE_CODE_ARRAY && TYPE_VECTOR (type2))) + if ((type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + || (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2))) { arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside); @@ -868,7 +868,7 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, (*pos)++; arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); type1 = check_typedef (value_type (arg1)); - if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) { struct value *arg3, *tmp, *ret; struct type *eltype2, *type3, *eltype3; @@ -880,9 +880,9 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, type2 = check_typedef (value_type (arg2)); type3 = check_typedef (value_type (arg3)); t2_is_vec - = TYPE_CODE (type2) == TYPE_CODE_ARRAY && TYPE_VECTOR (type2); + = type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2); t3_is_vec - = TYPE_CODE (type3) == TYPE_CODE_ARRAY && TYPE_VECTOR (type3); + = type3->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type3); /* Widen the scalar operand to a vector if necessary. */ if (t2_is_vec || !t3_is_vec) @@ -911,7 +911,7 @@ Cannot perform conditional operation on incompatible types")); error (_("Could not determine the vector bounds")); /* Throw an error if the types of arg2 or arg3 are incompatible. */ - if (TYPE_CODE (eltype2) != TYPE_CODE (eltype3) + if (eltype2->code () != eltype3->code () || TYPE_LENGTH (eltype2) != TYPE_LENGTH (eltype3) || TYPE_UNSIGNED (eltype2) != TYPE_UNSIGNED (eltype3) || lowb2 != lowb3 || highb2 != highb3) @@ -971,7 +971,7 @@ Cannot perform conditional operation on vectors with different sizes")); return value_from_longest (builtin_type (exp->gdbarch)-> builtin_int, 1); } - else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + else if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) { return opencl_component_ref (exp, arg1, &exp->elts[pc + 2].string, noside); @@ -1007,7 +1007,7 @@ opencl_print_type (struct type *type, const char *varstring, if (show > 0) { type = check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && TYPE_NAME (type) != NULL) show = 0; } diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c index 61901a7..37fb90c 100644 --- a/gdb/or1k-tdep.c +++ b/gdb/or1k-tdep.c @@ -245,7 +245,7 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype, gdb_byte *readbuf, const gdb_byte *writebuf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - enum type_code rv_type = TYPE_CODE (valtype); + enum type_code rv_type = valtype->code (); unsigned int rv_size = TYPE_LENGTH (valtype); int bpw = (gdbarch_tdep (gdbarch))->bytes_per_word; @@ -633,7 +633,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); if (TYPE_VARARGS (func_type) && argnum >= TYPE_NFIELDS (func_type)) break; /* end or regular args, varargs go to stack. */ @@ -723,7 +723,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode) || (len > bpw * 2)) @@ -755,7 +755,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); /* The EABI passes structures that do not fit in a register by reference. In all other cases, pass the structure by value. */ if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode) diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 213033d..e332fe9 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -257,7 +257,7 @@ exp : field_exp FIELDNAME search_field = 0; if (current_type) { - while (TYPE_CODE (current_type) + while (current_type->code () == TYPE_CODE_PTR) current_type = TYPE_TARGET_TYPE (current_type); @@ -275,7 +275,7 @@ exp : field_exp name search_field = 0; if (current_type) { - while (TYPE_CODE (current_type) + while (current_type->code () == TYPE_CODE_PTR) current_type = TYPE_TARGET_TYPE (current_type); @@ -357,9 +357,9 @@ exp : type '(' exp ')' %prec UNARY { if (current_type) { /* Allow automatic dereference of classes. */ - if ((TYPE_CODE (current_type) == TYPE_CODE_PTR) - && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_STRUCT) - && (TYPE_CODE ($1) == TYPE_CODE_STRUCT)) + if ((current_type->code () == TYPE_CODE_PTR) + && (TYPE_TARGET_TYPE (current_type)->code () == TYPE_CODE_STRUCT) + && (($1)->code () == TYPE_CODE_STRUCT)) write_exp_elt_opcode (pstate, UNOP_IND); } write_exp_elt_opcode (pstate, UNOP_CAST); @@ -601,7 +601,7 @@ exp : THIS this_type = NULL; if (this_type) { - if (TYPE_CODE (this_type) == TYPE_CODE_PTR) + if (this_type->code () == TYPE_CODE_PTR) { this_type = TYPE_TARGET_TYPE (this_type); write_exp_elt_opcode (pstate, UNOP_IND); @@ -666,8 +666,8 @@ qualified_name: typebase COLONCOLON name { struct type *type = $1; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) error (_("`%s' is not defined as an aggregate type."), TYPE_NAME (type)); diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 944a077..19dd850 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -100,7 +100,7 @@ is_pascal_string_type (struct type *type,int *length_pos, struct type **char_type, const char **arrayname) { - if (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type != NULL && type->code () == TYPE_CODE_STRUCT) { /* Old Borland type pascal strings from Free Pascal Compiler. */ /* Two fields: length and st. */ @@ -141,7 +141,7 @@ is_pascal_string_type (struct type *type,int *length_pos, { *char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 2)); - if (TYPE_CODE (*char_type) == TYPE_CODE_ARRAY) + if ((*char_type)->code () == TYPE_CODE_ARRAY) *char_type = TYPE_TARGET_TYPE (*char_type); } if (arrayname) diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 3b8d3be..4d6eb26 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -53,7 +53,7 @@ pascal_print_type (struct type *type, const char *varstring, enum type_code code; int demangled_args; - code = TYPE_CODE (type); + code = type->code (); if (show > 0) type = check_typedef (type); @@ -216,7 +216,7 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream, QUIT; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: fprintf_filtered (stream, "^"); @@ -229,7 +229,7 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream, if (passed_a_ptr) fprintf_filtered (stream, "("); if (TYPE_TARGET_TYPE (type) != NULL - && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { fprintf_filtered (stream, "function "); } @@ -258,7 +258,7 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream, fprintf_filtered (stream, "("); if (TYPE_TARGET_TYPE (type) != NULL - && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { fprintf_filtered (stream, "function "); } @@ -347,7 +347,7 @@ pascal_type_print_func_varspec_suffix (struct type *type, struct ui_file *strea const struct type_print_options *flags) { if (TYPE_TARGET_TYPE (type) == NULL - || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { fprintf_filtered (stream, " : "); pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), @@ -382,7 +382,7 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream, QUIT; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: if (passed_a_ptr) @@ -476,8 +476,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, } /* void pointer */ - if ((TYPE_CODE (type) == TYPE_CODE_PTR) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)) + if ((type->code () == TYPE_CODE_PTR) + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)) { fputs_filtered (TYPE_NAME (type) ? TYPE_NAME (type) : "pointer", stream); @@ -495,7 +495,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_TYPEDEF: case TYPE_CODE_PTR: @@ -707,8 +707,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, fprintf_filtered (stream, "destructor "); } else if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0 - && TYPE_CODE (TYPE_TARGET_TYPE ( - TYPE_FN_FIELD_TYPE (f, j))) != TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID) { fprintf_filtered (stream, "function "); } @@ -723,8 +722,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, stream); if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0 - && TYPE_CODE (TYPE_TARGET_TYPE ( - TYPE_FN_FIELD_TYPE (f, j))) != TYPE_CODE_VOID) + && TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID) { fputs_filtered (" : ", stream); type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), @@ -830,7 +828,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, an error (). */ fprintf_styled (stream, metadata_style.style (), "<invalid unnamed pascal type code %d>", - TYPE_CODE (type)); + type->code ()); } break; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index fbf5c5c..8172e04 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -82,7 +82,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, int want_space = 0; const gdb_byte *valaddr = value_contents_for_printing (val); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: { @@ -98,7 +98,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, is of TYPE_CODE_CHAR and element size is 1,2 or 4. */ if (options->format == 's' || ((eltlen == 1 || eltlen == 2 || eltlen == 4) - && TYPE_CODE (elttype) == TYPE_CODE_CHAR + && elttype->code () == TYPE_CODE_CHAR && options->format == 0)) { /* If requested, look for the first null char and only print @@ -167,7 +167,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, print_unpacked_pointer: elttype = check_typedef (TYPE_TARGET_TYPE (type)); - if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) + if (elttype->code () == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ print_address_demangle (options, gdbarch, addr, stream, demangle); @@ -183,10 +183,10 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, /* For a pointer to char or unsigned char, also print the string pointed to, unless pointer is null. */ if (((TYPE_LENGTH (elttype) == 1 - && (TYPE_CODE (elttype) == TYPE_CODE_INT - || TYPE_CODE (elttype) == TYPE_CODE_CHAR)) - || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4) - && TYPE_CODE (elttype) == TYPE_CODE_CHAR)) + && (elttype->code () == TYPE_CODE_INT + || elttype->code () == TYPE_CODE_CHAR)) + || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4) + && elttype->code () == TYPE_CODE_CHAR)) && (options->format == 0 || options->format == 's') && addr != 0) { @@ -397,7 +397,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, default: error (_("Invalid pascal type code %d in symbol table."), - TYPE_CODE (type)); + type->code ()); } } @@ -417,12 +417,12 @@ pascal_value_print (struct value *val, struct ui_file *stream, Object pascal: if it is a member pointer, we will take care of that when we print it. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF) + if (type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_REF) { /* Hack: remove (char *) for char strings. Their type is indicated by the quoted string anyway. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR + if (type->code () == TYPE_CODE_PTR && TYPE_NAME (type) == NULL && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0) @@ -481,15 +481,15 @@ pascal_object_is_vtbl_ptr_type (struct type *type) int pascal_object_is_vtbl_member (struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* If not using + if (type->code () == TYPE_CODE_STRUCT /* If not using thunks. */ - || TYPE_CODE (type) == TYPE_CODE_PTR) /* If using thunks. */ + || type->code () == TYPE_CODE_PTR) /* If using thunks. */ { /* Virtual functions tables are full of pointers to virtual functions. */ @@ -826,7 +826,7 @@ pascal_object_print_static_field (struct value *val, return; } - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { CORE_ADDR *first_dont_print, addr; int i; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 676be72..4c4bdac 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -250,8 +250,8 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION) + if ((valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION) && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8) && TYPE_VECTOR (valtype))) return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/ppc-nbsd-tdep.c b/gdb/ppc-nbsd-tdep.c index f2cca8f..ba4e943 100644 --- a/gdb/ppc-nbsd-tdep.c +++ b/gdb/ppc-nbsd-tdep.c @@ -75,8 +75,8 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function, gdb_byte *readbuf, const gdb_byte *writebuf) { #if 0 - if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION) + if ((valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION) && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8) && TYPE_VECTOR (valtype)) && !(TYPE_LENGTH (valtype) == 1 diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index d649010..9dcf84c 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -40,10 +40,10 @@ ppc_sysv_use_opencl_abi (struct type *ftype) { ftype = check_typedef (ftype); - if (TYPE_CODE (ftype) == TYPE_CODE_PTR) + if (ftype->code () == TYPE_CODE_PTR) ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); - return (TYPE_CODE (ftype) == TYPE_CODE_FUNC + return (ftype->code () == TYPE_CODE_FUNC && TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL); } @@ -124,7 +124,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int len = TYPE_LENGTH (type); const bfd_byte *val = value_contents (arg); - if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8 + if (type->code () == TYPE_CODE_FLT && len <= 8 && !tdep->soft_float) { /* Floating point value converted to "double" then @@ -164,7 +164,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, argoffset += len; } } - else if (TYPE_CODE (type) == TYPE_CODE_FLT + else if (type->code () == TYPE_CODE_FLT && len == 16 && !tdep->soft_float && (gdbarch_long_double_format (gdbarch) @@ -191,9 +191,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } else if (len == 8 - && (TYPE_CODE (type) == TYPE_CODE_INT /* long long */ - || TYPE_CODE (type) == TYPE_CODE_FLT /* double */ - || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT + && (type->code () == TYPE_CODE_INT /* long long */ + || type->code () == TYPE_CODE_FLT /* double */ + || (type->code () == TYPE_CODE_DECFLOAT && tdep->soft_float))) { /* "long long" or soft-float "double" or "_Decimal64" @@ -227,10 +227,10 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } else if (len == 16 - && ((TYPE_CODE (type) == TYPE_CODE_FLT + && ((type->code () == TYPE_CODE_FLT && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) - || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT + || (type->code () == TYPE_CODE_DECFLOAT && tdep->soft_float))) { /* Soft-float IBM long double or _Decimal128 passed in @@ -260,7 +260,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, greg += 4; } } - else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && len <= 8 + else if (type->code () == TYPE_CODE_DECFLOAT && len <= 8 && !tdep->soft_float) { /* 32-bit and 64-bit decimal floats go in f1 .. f8. They can @@ -299,7 +299,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, argoffset += len; } } - else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && len == 16 + else if (type->code () == TYPE_CODE_DECFLOAT && len == 16 && !tdep->soft_float) { /* 128-bit decimal floats go in f2 .. f7, always in even/odd @@ -334,7 +334,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, freg += 2; } else if (len < 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && opencl_abi) { @@ -347,7 +347,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { const gdb_byte *elval = val + i * TYPE_LENGTH (eltype); - if (TYPE_CODE (eltype) == TYPE_CODE_FLT && !tdep->soft_float) + if (eltype->code () == TYPE_CODE_FLT && !tdep->soft_float) { if (freg <= 8) { @@ -421,7 +421,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } else if (len >= 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && opencl_abi) { @@ -450,7 +450,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } else if (len == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { @@ -471,7 +471,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } else if (len == 8 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && tdep->vector_abi == POWERPC_VEC_SPE) { @@ -503,12 +503,12 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, gdb_byte word[PPC_MAX_REGISTER_SIZE]; memset (word, 0, PPC_MAX_REGISTER_SIZE); if (len > tdep->wordsize - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + || type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) { /* Structs and large values are put in an aligned stack slot ... */ - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && len >= 16) structoffset = align_up (structoffset, 16); @@ -523,7 +523,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, sp + structoffset); structoffset += len; } - else if (TYPE_CODE (type) == TYPE_CODE_INT) + else if (type->code () == TYPE_CODE_INT) /* Sign or zero extend the "int" into a "word". */ store_unsigned_integer (word, tdep->wordsize, byte_order, unpack_long (type, val)); @@ -599,7 +599,7 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - gdb_assert (TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT); + gdb_assert (valtype->code () == TYPE_CODE_DECFLOAT); /* 32-bit and 64-bit decimal floats in f1. */ if (TYPE_LENGTH (valtype) <= 8) @@ -681,7 +681,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, gdb_assert (tdep->wordsize == 4); - if (TYPE_CODE (type) == TYPE_CODE_FLT + if (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8 && !tdep->soft_float) { @@ -706,7 +706,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } return RETURN_VALUE_REGISTER_CONVENTION; } - if (TYPE_CODE (type) == TYPE_CODE_FLT + if (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 16 && !tdep->soft_float && (gdbarch_long_double_format (gdbarch) @@ -726,10 +726,10 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, return RETURN_VALUE_REGISTER_CONVENTION; } if (TYPE_LENGTH (type) == 16 - && ((TYPE_CODE (type) == TYPE_CODE_FLT + && ((type->code () == TYPE_CODE_FLT && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) - || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && tdep->soft_float))) + || (type->code () == TYPE_CODE_DECFLOAT && tdep->soft_float))) { /* Soft-float IBM long double or _Decimal128 stored in r3, r4, r5, r6. */ @@ -749,9 +749,9 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } return RETURN_VALUE_REGISTER_CONVENTION; } - if ((TYPE_CODE (type) == TYPE_CODE_INT && TYPE_LENGTH (type) == 8) - || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8) - || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8 + if ((type->code () == TYPE_CODE_INT && TYPE_LENGTH (type) == 8) + || (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8) + || (type->code () == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8 && tdep->soft_float)) { if (readbuf) @@ -770,15 +770,15 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } return RETURN_VALUE_REGISTER_CONVENTION; } - if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && !tdep->soft_float) + if (type->code () == TYPE_CODE_DECFLOAT && !tdep->soft_float) return get_decimal_float_return_value (gdbarch, type, regcache, readbuf, writebuf); - else if ((TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_CHAR - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_PTR + else if ((type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_CHAR + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type) - || TYPE_CODE (type) == TYPE_CODE_ENUM) + || type->code () == TYPE_CODE_ENUM) && TYPE_LENGTH (type) <= tdep->wordsize) { if (readbuf) @@ -803,7 +803,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } /* OpenCL vectors < 16 bytes are returned as distinct scalars in f1..f2 or r3..r10. */ - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && TYPE_LENGTH (type) < 16 && opencl_abi) @@ -815,7 +815,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, { int offset = i * TYPE_LENGTH (eltype); - if (TYPE_CODE (eltype) == TYPE_CODE_FLT) + if (eltype->code () == TYPE_CODE_FLT) { int regnum = tdep->ppc_fp0_regnum + 1 + i; gdb_byte regval[PPC_MAX_REGISTER_SIZE]; @@ -857,7 +857,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, return RETURN_VALUE_REGISTER_CONVENTION; } /* OpenCL vectors >= 16 bytes are returned in v2..v9. */ - if (TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && TYPE_LENGTH (type) >= 16 && opencl_abi) @@ -879,7 +879,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, return RETURN_VALUE_REGISTER_CONVENTION; } if (TYPE_LENGTH (type) == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { @@ -896,7 +896,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, return RETURN_VALUE_REGISTER_CONVENTION; } if (TYPE_LENGTH (type) == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && tdep->vector_abi == POWERPC_VEC_GENERIC) { @@ -920,7 +920,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, return RETURN_VALUE_REGISTER_CONVENTION; } if (TYPE_LENGTH (type) == 8 - && TYPE_CODE (type) == TYPE_CODE_ARRAY + && type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && tdep->vector_abi == POWERPC_VEC_SPE) { @@ -1076,25 +1076,25 @@ ppc64_aggregate_candidate (struct type *type, { type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: case TYPE_CODE_DECFLOAT: if (!*field_type) *field_type = type; - if (TYPE_CODE (*field_type) == TYPE_CODE (type) + if ((*field_type)->code () == type->code () && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type)) return 1; break; case TYPE_CODE_COMPLEX: type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT - || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + if (type->code () == TYPE_CODE_FLT + || type->code () == TYPE_CODE_DECFLOAT) { if (!*field_type) *field_type = type; - if (TYPE_CODE (*field_type) == TYPE_CODE (type) + if ((*field_type)->code () == type->code () && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type)) return 2; } @@ -1105,7 +1105,7 @@ ppc64_aggregate_candidate (struct type *type, { if (!*field_type) *field_type = type; - if (TYPE_CODE (*field_type) == TYPE_CODE (type) + if ((*field_type)->code () == type->code () && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type)) return 1; } @@ -1150,7 +1150,7 @@ ppc64_aggregate_candidate (struct type *type, if (sub_count == -1) return -1; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) count += sub_count; else count = std::max (count, sub_count); @@ -1184,17 +1184,17 @@ ppc64_elfv2_abi_homogeneous_aggregate (struct type *type, { /* Complex types at the top level are treated separately. However, complex types can be elements of homogeneous aggregates. */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || (TYPE_CODE (type) == TYPE_CODE_ARRAY && !TYPE_VECTOR (type))) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || (type->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (type))) { struct type *field_type = NULL; LONGEST field_count = ppc64_aggregate_candidate (type, &field_type); if (field_count > 0) { - int n_regs = ((TYPE_CODE (field_type) == TYPE_CODE_FLT - || TYPE_CODE (field_type) == TYPE_CODE_DECFLOAT)? + int n_regs = ((field_type->code () == TYPE_CODE_FLT + || field_type->code () == TYPE_CODE_DECFLOAT)? (TYPE_LENGTH (field_type) + 7) >> 3 : 1); /* The ELFv2 ABI allows homogeneous aggregates to occupy @@ -1323,7 +1323,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, return; if (TYPE_LENGTH (type) <= 8 - && TYPE_CODE (type) == TYPE_CODE_FLT) + && type->code () == TYPE_CODE_FLT) { /* Floats and doubles go in f1 .. f13. 32-bit floats are converted to double first. */ @@ -1340,7 +1340,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, argpos->freg++; } else if (TYPE_LENGTH (type) <= 8 - && TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + && type->code () == TYPE_CODE_DECFLOAT) { /* Floats and doubles go in f1 .. f13. 32-bit decimal floats are placed in the least significant word. */ @@ -1359,7 +1359,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, argpos->freg++; } else if (TYPE_LENGTH (type) == 16 - && TYPE_CODE (type) == TYPE_CODE_FLT + && type->code () == TYPE_CODE_FLT && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { @@ -1376,7 +1376,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, argpos->freg += 2; } else if (TYPE_LENGTH (type) == 16 - && TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + && type->code () == TYPE_CODE_DECFLOAT) { /* 128-bit decimal floating-point values are stored in and even/odd pair of FPRs, with the even FPR holding the most significant half. */ @@ -1421,14 +1421,14 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (TYPE_CODE (type) == TYPE_CODE_FLT - || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + if (type->code () == TYPE_CODE_FLT + || type->code () == TYPE_CODE_DECFLOAT) { /* Floating-point scalars are passed in floating-point registers. */ ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos); ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && tdep->vector_abi == POWERPC_VEC_ALTIVEC && TYPE_LENGTH (type) == 16) { @@ -1436,7 +1436,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 16, argpos); ppc64_sysv_abi_push_vreg (gdbarch, val, argpos); } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && TYPE_LENGTH (type) >= 16) { /* Non-Altivec vectors are passed by reference. */ @@ -1450,11 +1450,11 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, /* ... and pass a pointer to the copy as parameter. */ ppc64_sysv_abi_push_integer (gdbarch, addr, argpos); } - else if ((TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_ENUM - || TYPE_CODE (type) == TYPE_CODE_BOOL - || TYPE_CODE (type) == TYPE_CODE_CHAR - || TYPE_CODE (type) == TYPE_CODE_PTR + else if ((type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_ENUM + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_CHAR + || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)) && TYPE_LENGTH (type) <= tdep->wordsize) { @@ -1467,14 +1467,14 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, /* Convert any function code addresses into descriptors. */ if (tdep->elf_abi == POWERPC_ELF_V1 - && (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF)) + && (type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_REF)) { struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); - if (TYPE_CODE (target_type) == TYPE_CODE_FUNC - || TYPE_CODE (target_type) == TYPE_CODE_METHOD) + if (target_type->code () == TYPE_CODE_FUNC + || target_type->code () == TYPE_CODE_METHOD) { CORE_ADDR desc = word; @@ -1493,14 +1493,14 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, /* The ABI (version 1.9) specifies that structs containing a single floating-point value, at any level of nesting of single-member structs, are passed in floating-point registers. */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT + if (type->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) { - while (TYPE_CODE (type) == TYPE_CODE_STRUCT + while (type->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) type = check_typedef (TYPE_FIELD_TYPE (type, 0)); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); } @@ -1516,10 +1516,10 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, { const gdb_byte *elval = val + i * TYPE_LENGTH (eltype); - if (TYPE_CODE (eltype) == TYPE_CODE_FLT - || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT) + if (eltype->code () == TYPE_CODE_FLT + || eltype->code () == TYPE_CODE_DECFLOAT) ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos); - else if (TYPE_CODE (eltype) == TYPE_CODE_ARRAY + else if (eltype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (eltype) && tdep->vector_abi == POWERPC_VEC_ALTIVEC && TYPE_LENGTH (eltype) == 16) @@ -1635,7 +1635,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct type *type = check_typedef (value_type (arg)); const bfd_byte *val = value_contents (arg); - if (TYPE_CODE (type) == TYPE_CODE_COMPLEX) + if (type->code () == TYPE_CODE_COMPLEX) { /* Complex types are passed as if two independent scalars. */ struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); @@ -1644,7 +1644,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, ppc64_sysv_abi_push_param (gdbarch, eltype, val + TYPE_LENGTH (eltype), &argpos); } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && opencl_abi) { /* OpenCL vectors shorter than 16 bytes are passed as if @@ -1704,7 +1704,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct type *ftype = check_typedef (value_type (function)); CORE_ADDR desc_addr = value_as_address (function); - if (TYPE_CODE (ftype) == TYPE_CODE_PTR + if (ftype->code () == TYPE_CODE_PTR || convert_code_addr_to_desc_addr (func_addr, &desc_addr)) { /* The TOC is the second double word in the descriptor. */ @@ -1742,10 +1742,10 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* Integers live in GPRs starting at r3. */ - if ((TYPE_CODE (valtype) == TYPE_CODE_INT - || TYPE_CODE (valtype) == TYPE_CODE_ENUM - || TYPE_CODE (valtype) == TYPE_CODE_CHAR - || TYPE_CODE (valtype) == TYPE_CODE_BOOL) + if ((valtype->code () == TYPE_CODE_INT + || valtype->code () == TYPE_CODE_ENUM + || valtype->code () == TYPE_CODE_CHAR + || valtype->code () == TYPE_CODE_BOOL) && TYPE_LENGTH (valtype) <= 8) { int regnum = tdep->ppc_gp0_regnum + 3 + index; @@ -1772,7 +1772,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* Floats and doubles go in f1 .. f13. 32-bit floats are converted to double first. */ if (TYPE_LENGTH (valtype) <= 8 - && TYPE_CODE (valtype) == TYPE_CODE_FLT) + && valtype->code () == TYPE_CODE_FLT) { int regnum = tdep->ppc_fp0_regnum + 1 + index; struct type *regtype = register_type (gdbarch, regnum); @@ -1794,7 +1794,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* Floats and doubles go in f1 .. f13. 32-bit decimal floats are placed in the least significant word. */ if (TYPE_LENGTH (valtype) <= 8 - && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) + && valtype->code () == TYPE_CODE_DECFLOAT) { int regnum = tdep->ppc_fp0_regnum + 1 + index; int offset = 0; @@ -1813,7 +1813,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* IBM long double stored in two consecutive FPRs. */ if (TYPE_LENGTH (valtype) == 16 - && TYPE_CODE (valtype) == TYPE_CODE_FLT + && valtype->code () == TYPE_CODE_FLT && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { @@ -1835,7 +1835,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* 128-bit decimal floating-point values are stored in an even/odd pair of FPRs, with the even FPR holding the most significant half. */ if (TYPE_LENGTH (valtype) == 16 - && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) + && valtype->code () == TYPE_CODE_DECFLOAT) { int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index; int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0; @@ -1856,7 +1856,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* AltiVec vectors are returned in VRs starting at v2. */ if (TYPE_LENGTH (valtype) == 16 - && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + && valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { int regnum = tdep->ppc_vr0_regnum + 2 + index; @@ -1870,7 +1870,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* Short vectors are returned in GPRs starting at r3. */ if (TYPE_LENGTH (valtype) <= 8 - && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) + && valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) { int regnum = tdep->ppc_gp0_regnum + 3 + index; int offset = 0; @@ -1917,7 +1917,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, gdb_assert (ppc_floating_point_unit_p (gdbarch)); /* Complex types are returned as if two independent scalars. */ - if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX) + if (valtype->code () == TYPE_CODE_COMPLEX) { eltype = check_typedef (TYPE_TARGET_TYPE (valtype)); @@ -1938,7 +1938,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, /* OpenCL vectors shorter than 16 bytes are returned as if a series of independent scalars; OpenCL vectors 16 bytes or longer are returned as if a series of AltiVec vectors. */ - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) && opencl_abi) { if (TYPE_LENGTH (valtype) < 16) @@ -1962,7 +1962,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, } /* All pointers live in r3. */ - if (TYPE_CODE (valtype) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (valtype)) + if (valtype->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (valtype)) { int regnum = tdep->ppc_gp0_regnum + 3; @@ -1974,10 +1974,10 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, } /* Small character arrays are returned, right justified, in r3. */ - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY + if (valtype->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (valtype) && TYPE_LENGTH (valtype) <= 8 - && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT + && TYPE_TARGET_TYPE (valtype)->code () == TYPE_CODE_INT && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) { int regnum = tdep->ppc_gp0_regnum + 3; @@ -1996,9 +1996,9 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, aggregates are returned in registers. */ if (tdep->elf_abi == POWERPC_ELF_V2 && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt) - && (TYPE_CODE (eltype) == TYPE_CODE_FLT - || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT - || (TYPE_CODE (eltype) == TYPE_CODE_ARRAY + && (eltype->code () == TYPE_CODE_FLT + || eltype->code () == TYPE_CODE_DECFLOAT + || (eltype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (eltype) && tdep->vector_abi == POWERPC_VEC_ALTIVEC && TYPE_LENGTH (eltype) == 16))) @@ -2022,9 +2022,9 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, returned in registers r3:r4. */ if (tdep->elf_abi == POWERPC_ELF_V2 && TYPE_LENGTH (valtype) <= 16 - && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || (TYPE_CODE (valtype) == TYPE_CODE_ARRAY + && (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || (valtype->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (valtype)))) { int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 00320d2..c94ad0a 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -311,12 +311,12 @@ print_formatted (struct value *val, int size, } if (options->format == 0 || options->format == 's' - || TYPE_CODE (type) == TYPE_CODE_REF - || TYPE_CODE (type) == TYPE_CODE_ARRAY - || TYPE_CODE (type) == TYPE_CODE_STRING - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_NAMESPACE) + || type->code () == TYPE_CODE_REF + || type->code () == TYPE_CODE_ARRAY + || type->code () == TYPE_CODE_STRING + || type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_NAMESPACE) value_print (val, stream, options); else /* User specified format, so don't look to the type to tell us @@ -361,7 +361,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, /* If the value is a pointer, and pointers and addresses are not the same, then at this point, the value's length (in target bytes) is gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) len = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT; /* If we are printing it as unsigned, truncate it in case it is actually @@ -411,14 +411,14 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, range case, we want to avoid this, so we store the unpacked value here for possible use later. */ gdb::optional<LONGEST> val_long; - if ((TYPE_CODE (type) == TYPE_CODE_FLT + if ((type->code () == TYPE_CODE_FLT && (options->format == 'o' || options->format == 'x' || options->format == 't' || options->format == 'z' || options->format == 'd' || options->format == 'u')) - || (TYPE_CODE (type) == TYPE_CODE_RANGE + || (type->code () == TYPE_CODE_RANGE && TYPE_RANGE_DATA (type)->bias != 0)) { val_long.emplace (unpack_long (type, valaddr)); @@ -432,10 +432,10 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, of a floating-point type of the same length, if that exists. Otherwise, the data is printed as integer. */ char format = options->format; - if (format == 'f' && TYPE_CODE (type) != TYPE_CODE_FLT) + if (format == 'f' && type->code () != TYPE_CODE_FLT) { type = float_type_from_length (type); - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) format = 0; } @@ -451,7 +451,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, print_decimal_chars (stream, valaddr, len, false, byte_order); break; case 0: - if (TYPE_CODE (type) != TYPE_CODE_FLT) + if (type->code () != TYPE_CODE_FLT) { print_decimal_chars (stream, valaddr, len, !TYPE_UNSIGNED (type), byte_order); @@ -1218,7 +1218,7 @@ print_command_1 (const char *args, int voidprint) val = access_value_history (0); if (voidprint || (val && value_type (val) && - TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) + value_type (val)->code () != TYPE_CODE_VOID)) print_value (val, print_opts); } @@ -1681,8 +1681,7 @@ x_command (const char *exp, int from_tty) val = coerce_ref (val); /* In rvalue contexts, such as this, functions are coerced into pointers to functions. This makes "x/i main" work. */ - if (/* last_format == 'i' && */ - TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC + if (value_type (val)->code () == TYPE_CODE_FUNC && VALUE_LVAL (val) == lval_memory) next_address = value_address (val); else @@ -2198,7 +2197,7 @@ printf_c_string (struct ui_file *stream, const char *format, { const gdb_byte *str; - if (TYPE_CODE (value_type (value)) != TYPE_CODE_PTR + if (value_type (value)->code () != TYPE_CODE_PTR && VALUE_LVAL (value) == lval_internalvar && c_is_string_type_p (value_type (value))) { @@ -2379,7 +2378,7 @@ printf_floating (struct ui_file *stream, const char *format, In either case, the result of the conversion is a byte buffer formatted in the target format for the target type. */ - if (TYPE_CODE (fmt_type) == TYPE_CODE_FLT) + if (fmt_type->code () == TYPE_CODE_FLT) { param_type = float_type_from_length (param_type); if (param_type != value_type (value)) @@ -2549,7 +2548,7 @@ ui_printf (const char *arg, struct ui_file *stream) valtype = value_type (val_args[i]); if (TYPE_LENGTH (valtype) != TYPE_LENGTH (wctype) - || TYPE_CODE (valtype) != TYPE_CODE_INT) + || valtype->code () != TYPE_CODE_INT) error (_("expected wchar_t argument for %%lc")); bytes = value_contents (val_args[i]); diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index e05fb55..92ac555 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -253,7 +253,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (function))); /* Remember only non-void return types. */ - if (TYPE_CODE (ret_type) != TYPE_CODE_VOID) + if (ret_type->code () != TYPE_CODE_VOID) { struct value *func_value; diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index fb41e95..45bf51b 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -240,9 +240,9 @@ py_print_value (struct ui_out *out, struct value *val, if (args_type == MI_PRINT_ALL_VALUES) should_print = 1; else if (args_type == MI_PRINT_SIMPLE_VALUES - && TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) + && type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION) should_print = 1; } else if (args_type != NO_VALUES) diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c index 18bace9..f71bb1d 100644 --- a/gdb/python/py-lazy-string.c +++ b/gdb/python/py-lazy-string.c @@ -120,7 +120,7 @@ stpy_convert_to_value (PyObject *self, PyObject *args) gdb_assert (type != NULL); realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_PTR: /* If a length is specified we need to convert this to an array @@ -194,7 +194,7 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length, } realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_ARRAY: { @@ -258,7 +258,7 @@ stpy_lazy_string_elt_type (lazy_string_object *lazy) gdb_assert (type != NULL); realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_PTR: case TYPE_CODE_ARRAY: diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index db031e0..e62ff57 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -157,7 +157,7 @@ typy_get_code (PyObject *self, void *closure) { struct type *type = ((type_object *) self)->type; - return PyInt_FromLong (TYPE_CODE (type)); + return PyInt_FromLong (type->code ()); } /* Helper function for typy_fields which converts a single field to a @@ -181,7 +181,7 @@ convert_field (struct type *type, int field) { const char *attrstring; - if (TYPE_CODE (type) == TYPE_CODE_ENUM) + if (type->code () == TYPE_CODE_ENUM) { arg.reset (gdb_py_long_from_longest (TYPE_FIELD_ENUMVAL (type, field))); @@ -227,7 +227,7 @@ convert_field (struct type *type, int field) if (PyObject_SetAttrString (result.get (), "artificial", arg.get ()) < 0) return NULL; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) arg = gdbpy_ref<>::new_reference (field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False); else @@ -356,7 +356,7 @@ typy_fields (PyObject *self, PyObject *args) { struct type *type = ((type_object *) self)->type; - if (TYPE_CODE (type) != TYPE_CODE_ARRAY) + if (type->code () != TYPE_CODE_ARRAY) return typy_fields_items (self, iter_values); /* Array type. Handle this as a special case because the common @@ -405,9 +405,9 @@ typy_get_tag (PyObject *self, void *closure) struct type *type = ((type_object *) self)->type; const char *tagname = nullptr; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ENUM) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ENUM) tagname = TYPE_NAME (type); if (tagname == nullptr) @@ -463,17 +463,17 @@ typy_get_composite (struct type *type) GDB_PY_HANDLE_EXCEPTION (except); } - if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) break; type = TYPE_TARGET_TYPE (type); } /* If this is not a struct, union, or enum type, raise TypeError exception. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_ENUM - && TYPE_CODE (type) != TYPE_CODE_FUNC) + if (type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION + && type->code () != TYPE_CODE_ENUM + && type->code () != TYPE_CODE_FUNC) { PyErr_SetString (PyExc_TypeError, "Type is not a structure, union, enum, or function type."); @@ -579,16 +579,16 @@ typy_range (PyObject *self, PyObject *args) /* Initialize these to appease GCC warnings. */ LONGEST low = 0, high = 0; - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRING - && TYPE_CODE (type) != TYPE_CODE_RANGE) + if (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_STRING + && type->code () != TYPE_CODE_RANGE) { PyErr_SetString (PyExc_RuntimeError, _("This type does not have a range.")); return NULL; } - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: case TYPE_CODE_STRING: diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index bc75a68..2ebbe0a 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -251,7 +251,7 @@ valpy_referenced_value (PyObject *self, PyObject *args) scoped_value_mark free_values; self_val = ((value_object *) self)->value; - switch (TYPE_CODE (check_typedef (value_type (self_val)))) + switch (check_typedef (value_type (self_val))->code ()) { case TYPE_CODE_PTR: res_val = value_ind (self_val); @@ -400,11 +400,11 @@ valpy_get_dynamic_type (PyObject *self, void *closure) type = value_type (val); type = check_typedef (type); - if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type)) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) + if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type)) + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) { struct value *target; - int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR; + int was_pointer = type->code () == TYPE_CODE_PTR; if (was_pointer) target = value_ind (val); @@ -420,7 +420,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure) type = lookup_lvalue_reference_type (type); } } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) type = value_rtti_type (val, NULL, NULL, NULL); else { @@ -488,7 +488,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw) type = value_type (value); realtype = check_typedef (type); - switch (TYPE_CODE (realtype)) + switch (realtype->code ()) { case TYPE_CODE_ARRAY: { @@ -846,10 +846,10 @@ value_has_field (struct value *v, PyObject *field) { val_type = value_type (v); val_type = check_typedef (val_type); - if (TYPE_IS_REFERENCE (val_type) || TYPE_CODE (val_type) == TYPE_CODE_PTR) + if (TYPE_IS_REFERENCE (val_type) || val_type->code () == TYPE_CODE_PTR) val_type = check_typedef (TYPE_TARGET_TYPE (val_type)); - type_code = TYPE_CODE (val_type); + type_code = val_type->code (); if ((type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION) && types_equal (val_type, parent_type)) has_field = 1; @@ -997,12 +997,12 @@ valpy_getitem (PyObject *self, PyObject *key) struct type *val_type; val_type = check_typedef (value_type (tmp)); - if (TYPE_CODE (val_type) == TYPE_CODE_PTR) + if (val_type->code () == TYPE_CODE_PTR) res_val = value_cast (lookup_pointer_type (base_class_type), tmp); - else if (TYPE_CODE (val_type) == TYPE_CODE_REF) + else if (val_type->code () == TYPE_CODE_REF) res_val = value_cast (lookup_lvalue_reference_type (base_class_type), tmp); - else if (TYPE_CODE (val_type) == TYPE_CODE_RVALUE_REF) + else if (val_type->code () == TYPE_CODE_RVALUE_REF) res_val = value_cast (lookup_rvalue_reference_type (base_class_type), tmp); else @@ -1023,8 +1023,8 @@ valpy_getitem (PyObject *self, PyObject *key) tmp = coerce_ref (tmp); type = check_typedef (value_type (tmp)); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_PTR) + if (type->code () != TYPE_CODE_ARRAY + && type->code () != TYPE_CODE_PTR) error (_("Cannot subscript requested type.")); else res_val = value_subscript (tmp, value_as_long (idx)); @@ -1072,7 +1072,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords) GDB_PY_HANDLE_EXCEPTION (except); } - if (TYPE_CODE (ftype) != TYPE_CODE_FUNC) + if (ftype->code () != TYPE_CODE_FUNC) { PyErr_SetString (PyExc_RuntimeError, _("Value is not callable (not TYPE_CODE_FUNC).")); @@ -1279,10 +1279,10 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other) rtype = STRIP_REFERENCE (rtype); handled = 1; - if (TYPE_CODE (ltype) == TYPE_CODE_PTR + if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype)) res_val = value_ptradd (arg1, value_as_long (arg2)); - else if (TYPE_CODE (rtype) == TYPE_CODE_PTR + else if (rtype->code () == TYPE_CODE_PTR && is_integral_type (ltype)) res_val = value_ptradd (arg2, value_as_long (arg1)); else @@ -1303,12 +1303,12 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other) rtype = STRIP_REFERENCE (rtype); handled = 1; - if (TYPE_CODE (ltype) == TYPE_CODE_PTR - && TYPE_CODE (rtype) == TYPE_CODE_PTR) + if (ltype->code () == TYPE_CODE_PTR + && rtype->code () == TYPE_CODE_PTR) /* A ptrdiff_t for the target would be preferable here. */ res_val = value_from_longest (builtin_type_pyint, value_ptrdiff (arg1, arg2)); - else if (TYPE_CODE (ltype) == TYPE_CODE_PTR + else if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype)) res_val = value_ptradd (arg1, - value_as_long (arg2)); else @@ -1492,7 +1492,7 @@ valpy_nonzero (PyObject *self) { type = check_typedef (value_type (self_value->value)); - if (is_integral_type (type) || TYPE_CODE (type) == TYPE_CODE_PTR) + if (is_integral_type (type) || type->code () == TYPE_CODE_PTR) nonzero = !!value_as_long (self_value->value); else if (is_floating_value (self_value->value)) nonzero = !target_float_is_zero (value_contents (self_value->value), @@ -1684,7 +1684,7 @@ valpy_int (PyObject *self) } if (!is_integral_type (type) - && TYPE_CODE (type) != TYPE_CODE_PTR) + && type->code () != TYPE_CODE_PTR) error (_("Cannot convert value to int.")); l = value_as_long (value); @@ -1720,7 +1720,7 @@ valpy_long (PyObject *self) type = check_typedef (type); if (!is_integral_type (type) - && TYPE_CODE (type) != TYPE_CODE_PTR) + && type->code () != TYPE_CODE_PTR) error (_("Cannot convert value to long.")); l = value_as_long (value); @@ -1748,9 +1748,9 @@ valpy_float (PyObject *self) { type = check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT && is_floating_value (value)) + if (type->code () == TYPE_CODE_FLT && is_floating_value (value)) d = target_float_to_host_double (value_contents (value), type); - else if (TYPE_CODE (type) == TYPE_CODE_INT) + else if (type->code () == TYPE_CODE_INT) { /* Note that valpy_long accepts TYPE_CODE_PTR and some others here here -- but casting a pointer or bool to a @@ -1972,7 +1972,7 @@ gdbpy_convenience_variable (PyObject *self, PyObject *args) if (var != NULL) { res_val = value_of_internalvar (python_gdbarch, var); - if (TYPE_CODE (value_type (res_val)) == TYPE_CODE_VOID) + if (value_type (res_val)->code () == TYPE_CODE_VOID) res_val = NULL; } } diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c index 274d1bf..d223d49 100644 --- a/gdb/python/py-xmethods.c +++ b/gdb/python/py-xmethods.c @@ -425,7 +425,7 @@ python_xmethod_worker::do_get_result_type (value *obj, obj_type = check_typedef (value_type (obj)); this_type = check_typedef (type_object_to_type (m_this_type)); - if (TYPE_CODE (obj_type) == TYPE_CODE_PTR) + if (obj_type->code () == TYPE_CODE_PTR) { struct type *this_ptr = lookup_pointer_type (this_type); @@ -435,7 +435,7 @@ python_xmethod_worker::do_get_result_type (value *obj, else if (TYPE_IS_REFERENCE (obj_type)) { struct type *this_ref - = lookup_reference_type (this_type, TYPE_CODE (obj_type)); + = lookup_reference_type (this_type, obj_type->code ()); if (!types_equal (obj_type, this_ref)) obj = value_cast (this_ref, obj); @@ -510,7 +510,7 @@ python_xmethod_worker::invoke (struct value *obj, obj_type = check_typedef (value_type (obj)); this_type = check_typedef (type_object_to_type (m_this_type)); - if (TYPE_CODE (obj_type) == TYPE_CODE_PTR) + if (obj_type->code () == TYPE_CODE_PTR) { struct type *this_ptr = lookup_pointer_type (this_type); @@ -520,7 +520,7 @@ python_xmethod_worker::invoke (struct value *obj, else if (TYPE_IS_REFERENCE (obj_type)) { struct type *this_ref - = lookup_reference_type (this_type, TYPE_CODE (obj_type)); + = lookup_reference_type (this_type, obj_type->code ()); if (!types_equal (obj_type, this_ref)) obj = value_cast (this_ref, obj); diff --git a/gdb/regcache.c b/gdb/regcache.c index 1be7945..417d61c 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -101,7 +101,7 @@ init_regcache_descr (struct gdbarch *gdbarch) /* Lay out the register cache. - NOTE: cagney/2002-05-22: Only register_type() is used when + NOTE: cagney/2002-05-22: Only register_type () is used when constructing the register cache. It is assumed that the register's raw size, virtual size and type length are all the same. */ @@ -1810,17 +1810,17 @@ cooked_write_test (struct gdbarch *gdbarch) std::vector<gdb_byte> buf (register_size (gdbarch, regnum), 0); const auto type = register_type (gdbarch, regnum); - if (TYPE_CODE (type) == TYPE_CODE_FLT - || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + if (type->code () == TYPE_CODE_FLT + || type->code () == TYPE_CODE_DECFLOAT) { /* Generate valid float format. */ target_float_from_string (expected.data (), type, "1.25"); } - else if (TYPE_CODE (type) == TYPE_CODE_INT - || TYPE_CODE (type) == TYPE_CODE_ARRAY - || TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_ARRAY + || type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_STRUCT) { if (bfd_arch == bfd_arch_ia64 || (regnum >= gdbarch_num_regs (gdbarch) @@ -1850,7 +1850,7 @@ cooked_write_test (struct gdbarch *gdbarch) expected[j] = j; } } - else if (TYPE_CODE (type) == TYPE_CODE_FLAGS) + else if (type->code () == TYPE_CODE_FLAGS) { /* No idea how to test flags. */ continue; diff --git a/gdb/reggroups.c b/gdb/reggroups.c index aaaadd7..83d7b49 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -202,8 +202,8 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, if (group == all_reggroup) return 1; vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); - float_p = (TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT - || (TYPE_CODE (register_type (gdbarch, regnum)) + float_p = (register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT + || (register_type (gdbarch, regnum)->code () == TYPE_CODE_DECFLOAT)); raw_p = regnum < gdbarch_num_regs (gdbarch); if (group == float_reggroup) diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 1bb824e..c1c466f 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -574,7 +574,7 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum) present the registers using a union type. */ int flen = riscv_isa_flen (gdbarch); if (flen == 8 - && TYPE_CODE (type) == TYPE_CODE_FLT + && type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == flen && (strcmp (TYPE_NAME (type), "builtin_type_ieee_double") == 0 || strcmp (TYPE_NAME (type), "double") == 0)) @@ -587,7 +587,7 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum) || regnum == RISCV_SP_REGNUM || regnum == RISCV_GP_REGNUM || regnum == RISCV_TP_REGNUM) - && TYPE_CODE (type) == TYPE_CODE_INT + && type->code () == TYPE_CODE_INT && TYPE_LENGTH (type) == xlen) { /* This spots the case where some interesting registers are defined @@ -640,16 +640,16 @@ riscv_print_one_register_info (struct gdbarch *gdbarch, print_raw_format = (value_entirely_available (val) && !value_optimized_out (val)); - if (TYPE_CODE (regtype) == TYPE_CODE_FLT - || (TYPE_CODE (regtype) == TYPE_CODE_UNION + if (regtype->code () == TYPE_CODE_FLT + || (regtype->code () == TYPE_CODE_UNION && TYPE_NFIELDS (regtype) == 2 - && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 0)) == TYPE_CODE_FLT - && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 1)) == TYPE_CODE_FLT) - || (TYPE_CODE (regtype) == TYPE_CODE_UNION + && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT + && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT) + || (regtype->code () == TYPE_CODE_UNION && TYPE_NFIELDS (regtype) == 3 - && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 0)) == TYPE_CODE_FLT - && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 1)) == TYPE_CODE_FLT - && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 2)) == TYPE_CODE_FLT)) + && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT + && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT + && TYPE_FIELD_TYPE (regtype, 2)->code () == TYPE_CODE_FLT)) { struct value_print_options opts; const gdb_byte *valaddr = value_contents_for_printing (val); @@ -1628,7 +1628,7 @@ static ULONGEST riscv_type_align (gdbarch *gdbarch, type *type) { type = check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) return std::min (TYPE_LENGTH (type), (ULONGEST) BIGGEST_ALIGNMENT); /* Anything else will be aligned by the generic code. */ @@ -2057,7 +2057,7 @@ riscv_struct_info::analyse_inner (struct type *type, int offset) int field_offset = offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT; - switch (TYPE_CODE (field_type)) + switch (field_type->code ()) { case TYPE_CODE_STRUCT: analyse_inner (field_type, field_offset); @@ -2104,7 +2104,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo, sinfo.analyse (ainfo->type); if (sinfo.number_of_fields () == 1 - && TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_COMPLEX) + && sinfo.field_type(0)->code () == TYPE_CODE_COMPLEX) { /* The following is similar to RISCV_CALL_ARG_COMPLEX_FLOAT, except we use the type of the complex field instead of the @@ -2134,7 +2134,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo, } if (sinfo.number_of_fields () == 1 - && TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_FLT) + && sinfo.field_type(0)->code () == TYPE_CODE_FLT) { /* The following is similar to RISCV_CALL_ARG_SCALAR_FLOAT, except we use the type of the first scalar field instead of @@ -2157,9 +2157,9 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo, } if (sinfo.number_of_fields () == 2 - && TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_FLT + && sinfo.field_type(0)->code () == TYPE_CODE_FLT && TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->flen - && TYPE_CODE (sinfo.field_type (1)) == TYPE_CODE_FLT + && sinfo.field_type(1)->code () == TYPE_CODE_FLT && TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->flen && riscv_arg_regs_available (&cinfo->float_regs) >= 2) { @@ -2183,7 +2183,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo, if (sinfo.number_of_fields () == 2 && riscv_arg_regs_available (&cinfo->int_regs) >= 1 - && (TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_FLT + && (sinfo.field_type(0)->code () == TYPE_CODE_FLT && TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->flen && is_integral_type (sinfo.field_type (1)) && TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->xlen)) @@ -2207,7 +2207,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo, && riscv_arg_regs_available (&cinfo->int_regs) >= 1 && (is_integral_type (sinfo.field_type (0)) && TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->xlen - && TYPE_CODE (sinfo.field_type (1)) == TYPE_CODE_FLT + && sinfo.field_type(1)->code () == TYPE_CODE_FLT && TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->flen)) { int len0 = TYPE_LENGTH (sinfo.field_type (0)); @@ -2260,7 +2260,7 @@ riscv_arg_location (struct gdbarch *gdbarch, ainfo->argloc[0].c_length = 0; ainfo->argloc[1].c_length = 0; - switch (TYPE_CODE (ainfo->type)) + switch (ainfo->type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -2428,7 +2428,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch, struct type *ftype = check_typedef (value_type (function)); - if (TYPE_CODE (ftype) == TYPE_CODE_PTR) + if (ftype->code () == TYPE_CODE_PTR) ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); /* We'll use register $a0 if we're returning a struct. */ diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index aca7649..ba54454 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -1048,8 +1048,8 @@ rl78_pointer_to_address (struct gdbarch *gdbarch, = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); /* Is it a code address? */ - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD + if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC + || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)) || TYPE_LENGTH (type) == 4) return rl78_make_instruction_address (addr); diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index b5add64..66b75a7 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -349,7 +349,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, type = check_typedef (value_type (arg)); len = TYPE_LENGTH (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) { /* Floating point arguments are passed in fpr's, as well as gpr's. There are 13 fpr's reserved for passing parameters. At this point @@ -473,7 +473,7 @@ ran_out_of_registers_for_arguments: /* Float types should be passed in fpr's, as well as in the stack. */ - if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13) + if (type->code () == TYPE_CODE_FLT && f_argno < 13) { gdb_assert (len <= 8); @@ -527,7 +527,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, /* AltiVec extension: Functions that declare a vector data type as a return value place that return value in VR2. */ - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) && TYPE_LENGTH (valtype) == 16) { if (readbuf) @@ -543,16 +543,16 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, allocated buffer into which the callee is assumed to store its return value. All explicit parameters are appropriately relabeled. */ - if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + if (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY) return RETURN_VALUE_STRUCT_CONVENTION; /* Scalar floating-point values are returned in FPR1 for float or double, and in FPR1:FPR2 for quadword precision. Fortran complex*8 and complex*16 are returned in FPR1:FPR2, and complex*32 is returned in FPR1:FPR4. */ - if (TYPE_CODE (valtype) == TYPE_CODE_FLT + if (valtype->code () == TYPE_CODE_FLT && (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8)) { struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); @@ -608,7 +608,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, if (TYPE_LENGTH (valtype) == 8) { - gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_FLT); + gdb_assert (valtype->code () != TYPE_CODE_FLT); gdb_assert (tdep->wordsize == 4); if (readbuf) diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c index 0a20a17..7f1825d 100644 --- a/gdb/rs6000-lynx178-tdep.c +++ b/gdb/rs6000-lynx178-tdep.c @@ -96,7 +96,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch, type = check_typedef (value_type (arg)); len = TYPE_LENGTH (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) { /* Floating point arguments are passed in fpr's, as well as gpr's. @@ -222,7 +222,7 @@ ran_out_of_registers_for_arguments: /* Float types should be passed in fpr's, as well as in the stack. */ - if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13) + if (type->code () == TYPE_CODE_FLT && f_argno < 13) { gdb_assert (len <= 8); @@ -274,7 +274,7 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, /* AltiVec extension: Functions that declare a vector data type as a return value place that return value in VR2. */ - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) && TYPE_LENGTH (valtype) == 16) { if (readbuf) @@ -290,16 +290,16 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, allocated buffer into which the callee is assumed to store its return value. All explicit parameters are appropriately relabeled. */ - if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + if (valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY) return RETURN_VALUE_STRUCT_CONVENTION; /* Scalar floating-point values are returned in FPR1 for float or double, and in FPR1:FPR2 for quadword precision. Fortran complex*8 and complex*16 are returned in FPR1:FPR2, and complex*32 is returned in FPR1:FPR4. */ - if (TYPE_CODE (valtype) == TYPE_CODE_FLT + if (valtype->code () == TYPE_CODE_FLT && (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8)) { struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); @@ -355,7 +355,7 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, if (TYPE_LENGTH (valtype) == 8) { - gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_FLT); + gdb_assert (valtype->code () != TYPE_CODE_FLT); gdb_assert (tdep->wordsize == 4); if (readbuf) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 9067894..3ccb307 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2531,7 +2531,7 @@ rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum, return (tdep->ppc_fp0_regnum >= 0 && regnum >= tdep->ppc_fp0_regnum && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs - && TYPE_CODE (type) == TYPE_CODE_FLT + && type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) != TYPE_LENGTH (builtin_type (gdbarch)->builtin_double)); } @@ -2546,7 +2546,7 @@ rs6000_register_to_value (struct frame_info *frame, struct gdbarch *gdbarch = get_frame_arch (frame); gdb_byte from[PPC_MAX_REGISTER_SIZE]; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + gdb_assert (type->code () == TYPE_CODE_FLT); if (!get_frame_register_bytes (frame, regnum, 0, register_size (gdbarch, regnum), @@ -2568,7 +2568,7 @@ rs6000_value_to_register (struct frame_info *frame, struct gdbarch *gdbarch = get_frame_arch (frame); gdb_byte to[PPC_MAX_REGISTER_SIZE]; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + gdb_assert (type->code () == TYPE_CODE_FLT); target_float_convert (from, type, to, builtin_type (gdbarch)->builtin_double); diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index de4a816..6e3e492 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -2334,7 +2334,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, call expression. */ rust_op_vector *params = operation->right.params; - if (TYPE_CODE (type) != TYPE_CODE_NAMESPACE) + if (type->code () != TYPE_CODE_NAMESPACE) { if (!rust_tuple_struct_type_p (type)) error (_("Type %s is not a tuple struct"), varname); @@ -2413,7 +2413,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, error (_("No symbol '%s' in current context"), varname); if (!want_type - && TYPE_CODE (type) == TYPE_CODE_STRUCT + && type->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 0) { /* A unit-like struct. */ @@ -2470,7 +2470,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, if (type == NULL) error (_("Could not find type '%s'"), operation->left.sval.ptr); - if (TYPE_CODE (type) != TYPE_CODE_STRUCT + if (type->code () != TYPE_CODE_STRUCT || rust_tuple_type_p (type) || rust_tuple_struct_type_p (type)) error (_("Struct expression applied to non-struct type")); diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index eb0ea1b..b8cc4da 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -109,7 +109,7 @@ rust_tuple_type_p (struct type *type) /* The current implementation is a bit of a hack, but there's nothing else in the debuginfo to distinguish a tuple from a struct. */ - return (TYPE_CODE (type) == TYPE_CODE_STRUCT + return (type->code () == TYPE_CODE_STRUCT && TYPE_NAME (type) != NULL && TYPE_NAME (type)[0] == '('); } @@ -124,7 +124,7 @@ rust_underscore_fields (struct type *type) field_number = 0; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT) + if (type->code () != TYPE_CODE_STRUCT) return false; for (i = 0; i < TYPE_NFIELDS (type); ++i) { @@ -157,7 +157,7 @@ rust_tuple_struct_type_p (struct type *type) static bool rust_slice_type_p (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_STRUCT + return (type->code () == TYPE_CODE_STRUCT && TYPE_NAME (type) != NULL && (strncmp (TYPE_NAME (type), "&[", 2) == 0 || strcmp (TYPE_NAME (type), "&str") == 0)); @@ -170,7 +170,7 @@ rust_range_type_p (struct type *type) { int i; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT + if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) > 2 || TYPE_NAME (type) == NULL || strstr (TYPE_NAME (type), "::Range") == NULL) @@ -211,7 +211,7 @@ rust_inclusive_range_type_p (struct type *type) static bool rust_u8_type_p (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_INT + return (type->code () == TYPE_CODE_INT && TYPE_UNSIGNED (type) && TYPE_LENGTH (type) == 1); } @@ -221,7 +221,7 @@ rust_u8_type_p (struct type *type) static bool rust_chartype_p (struct type *type) { - return (TYPE_CODE (type) == TYPE_CODE_CHAR + return (type->code () == TYPE_CODE_CHAR && TYPE_LENGTH (type) == 4 && TYPE_UNSIGNED (type)); } @@ -234,13 +234,13 @@ rust_is_string_type_p (struct type *type) LONGEST low_bound, high_bound; type = check_typedef (type); - return ((TYPE_CODE (type) == TYPE_CODE_STRING) - || (TYPE_CODE (type) == TYPE_CODE_PTR - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY + return ((type->code () == TYPE_CODE_STRING) + || (type->code () == TYPE_CODE_PTR + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY && rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type))) && get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound, &high_bound))) - || (TYPE_CODE (type) == TYPE_CODE_STRUCT + || (type->code () == TYPE_CODE_STRUCT && !rust_enum_p (type) && rust_slice_type_p (type) && strcmp (TYPE_NAME (type), "&str") == 0)); @@ -255,7 +255,7 @@ rust_get_trait_object_pointer (struct value *value) { struct type *type = check_typedef (value_type (value)); - if (TYPE_CODE (type) != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2) + if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2) return NULL; /* Try to be a bit resilient if the ABI changes. */ @@ -559,13 +559,13 @@ rust_value_print_inner (struct value *val, struct ui_file *stream, ? Val_prettyformat : Val_no_prettyformat); struct type *type = check_typedef (value_type (val)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_PTR: { LONGEST low_bound, high_bound; - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY + if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY && rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type))) && get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound, &high_bound)) @@ -712,7 +712,7 @@ rust_print_struct_def (struct type *type, const char *varstring, if (prop != nullptr && prop->kind == PROP_TYPE) type = prop->data.original_type; } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) fputs_filtered ("struct ", stream); else fputs_filtered ("union ", stream); @@ -828,7 +828,7 @@ rust_internal_print_type (struct type *type, const char *varstring, { /* Rust calls the unit type "void" in its debuginfo, but we don't want to print it as that. */ - if (TYPE_CODE (type) == TYPE_CODE_VOID) + if (type->code () == TYPE_CODE_VOID) fputs_filtered ("()", stream); else fputs_filtered (TYPE_NAME (type), stream); @@ -836,7 +836,7 @@ rust_internal_print_type (struct type *type, const char *varstring, } type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_VOID: /* If we have an enum, we've already printed the type's @@ -865,7 +865,7 @@ rust_internal_print_type (struct type *type, const char *varstring, } fputs_filtered (")", stream); /* If it returns unit, we can omit the return type. */ - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) + if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) { fputs_filtered (" -> ", stream); rust_internal_print_type (TYPE_TARGET_TYPE (type), "", stream, @@ -1151,13 +1151,13 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside) args[0] = arg0; /* We don't yet implement real Deref semantics. */ - while (TYPE_CODE (value_type (args[0])) == TYPE_CODE_PTR) + while (value_type (args[0])->code () == TYPE_CODE_PTR) args[0] = value_ind (args[0]); type = value_type (args[0]); - if ((TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_ENUM) + if ((type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_UNION + && type->code () != TYPE_CODE_ENUM) || rust_tuple_type_p (type)) error (_("Method calls only supported on struct or enum types")); if (TYPE_NAME (type) == NULL) @@ -1174,7 +1174,7 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside) if (TYPE_NFIELDS (fn_type) == 0) error (_("Function '%s' takes no arguments"), name.c_str ()); - if (TYPE_CODE (TYPE_FIELD_TYPE (fn_type, 0)) == TYPE_CODE_PTR) + if (TYPE_FIELD_TYPE (fn_type, 0)->code () == TYPE_CODE_PTR) args[0] = value_addr (args[0]); function = address_of_variable (sym.symbol, block); @@ -1361,7 +1361,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, if (noside == EVAL_AVOID_SIDE_EFFECTS) { struct type *base_type = nullptr; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) base_type = TYPE_TARGET_TYPE (type); else if (rust_slice_type_p (type)) { @@ -1376,7 +1376,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, if (base_type == nullptr) error (_("Could not find 'data_ptr' in slice type")); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR) + else if (type->code () == TYPE_CODE_PTR) base_type = TYPE_TARGET_TYPE (type); else error (_("Cannot subscript non-array type")); @@ -1405,7 +1405,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, LONGEST low_bound; struct value *base; - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { base = lhs; if (!get_array_bounds (type, &low_bound, &high_bound)) @@ -1423,7 +1423,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, low_bound = 0; high_bound = value_as_long (len); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR) + else if (type->code () == TYPE_CODE_PTR) { base = lhs; low_bound = 0; @@ -1526,7 +1526,7 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp, /* Preserving the type is enough. */ return value; } - if (TYPE_CODE (value_type (value)) == TYPE_CODE_BOOL) + if (value_type (value)->code () == TYPE_CODE_BOOL) result = value_from_longest (value_type (value), value_logical_not (value)); else @@ -1655,7 +1655,7 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp, type = value_type (lhs); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_STRUCT) { struct type *outer_type = NULL; @@ -1727,7 +1727,7 @@ tuple structs, and tuple-like enum variants")); const char *field_name = &exp->elts[pc + 2].string; type = value_type (lhs); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT && rust_enum_p (type)) + if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type)) { gdb::array_view<const gdb_byte> view (value_contents (lhs), TYPE_LENGTH (type)); diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c index c14ce20..9963bc3 100644 --- a/gdb/rx-tdep.c +++ b/gdb/rx-tdep.c @@ -668,12 +668,12 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct type *func_type = value_type (function); /* Dereference function pointer types. */ - while (TYPE_CODE (func_type) == TYPE_CODE_PTR) + while (func_type->code () == TYPE_CODE_PTR) func_type = TYPE_TARGET_TYPE (func_type); /* The end result had better be a function or a method. */ - gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC - || TYPE_CODE (func_type) == TYPE_CODE_METHOD); + gdb_assert (func_type->code () == TYPE_CODE_FUNC + || func_type->code () == TYPE_CODE_METHOD); /* Functions with a variable number of arguments have all of their variable arguments and the last non-variable argument passed @@ -706,8 +706,8 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { struct type *return_type = TYPE_TARGET_TYPE (func_type); - gdb_assert (TYPE_CODE (return_type) == TYPE_CODE_STRUCT - || TYPE_CODE (func_type) == TYPE_CODE_UNION); + gdb_assert (return_type->code () == TYPE_CODE_STRUCT + || func_type->code () == TYPE_CODE_UNION); if (TYPE_LENGTH (return_type) > 16 || TYPE_LENGTH (return_type) % 4 != 0) @@ -728,7 +728,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (i == 0 && struct_addr != 0 && return_method != return_method_struct - && TYPE_CODE (arg_type) == TYPE_CODE_PTR + && arg_type->code () == TYPE_CODE_PTR && extract_unsigned_integer (arg_bits, 4, byte_order) == struct_addr) { @@ -739,8 +739,8 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function, regcache_cooked_write_unsigned (regcache, RX_R15_REGNUM, struct_addr); } - else if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT - && TYPE_CODE (arg_type) != TYPE_CODE_UNION + else if (arg_type->code () != TYPE_CODE_STRUCT + && arg_type->code () != TYPE_CODE_UNION && arg_size <= 8) { /* Argument is a scalar. */ @@ -874,8 +874,8 @@ rx_return_value (struct gdbarch *gdbarch, ULONGEST valtype_len = TYPE_LENGTH (valtype); if (TYPE_LENGTH (valtype) > 16 - || ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION) + || ((valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION) && TYPE_LENGTH (valtype) % 4 != 0)) return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c index 4d2feba..607652c 100644 --- a/gdb/s12z-tdep.c +++ b/gdb/s12z-tdep.c @@ -614,9 +614,9 @@ s12z_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY || TYPE_LENGTH (type) > 4) return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index d8c28c7..e94bf59 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -63,7 +63,7 @@ s390_type_align (gdbarch *gdbarch, struct type *t) if (TYPE_LENGTH (t) > 8) { - switch (TYPE_CODE (t)) + switch (t->code ()) { case TYPE_CODE_INT: case TYPE_CODE_RANGE: @@ -1638,7 +1638,7 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, static struct type * s390_effective_inner_type (struct type *type, unsigned int min_size) { - while (TYPE_CODE (type) == TYPE_CODE_STRUCT) + while (type->code () == TYPE_CODE_STRUCT) { struct type *inner = NULL; @@ -1681,8 +1681,8 @@ s390_function_arg_float (struct type *type) or double. */ type = s390_effective_inner_type (type, 0); - return (TYPE_CODE (type) == TYPE_CODE_FLT - || TYPE_CODE (type) == TYPE_CODE_DECFLOAT); + return (type->code () == TYPE_CODE_FLT + || type->code () == TYPE_CODE_DECFLOAT); } /* Return non-zero if TYPE should be passed like a vector. */ @@ -1696,7 +1696,7 @@ s390_function_arg_vector (struct type *type) /* Structs containing just a vector are passed like a vector. */ type = s390_effective_inner_type (type, TYPE_LENGTH (type)); - return TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type); + return type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type); } /* Determine whether N is a power of two. */ @@ -1714,7 +1714,7 @@ is_power_of_two (unsigned int n) static int s390_function_arg_integer (struct type *type) { - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); if (TYPE_LENGTH (type) > 8) return 0; @@ -1921,7 +1921,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function, CORE_ADDR param_area_start, new_sp; struct type *ftype = check_typedef (value_type (function)); - if (TYPE_CODE (ftype) == TYPE_CODE_PTR) + if (ftype->code () == TYPE_CODE_PTR) ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); arg_prep.copy = sp; @@ -2021,7 +2021,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int word_size = gdbarch_ptr_bit (gdbarch) / 8; int length = TYPE_LENGTH (type); - int code = TYPE_CODE (type); + int code = type->code (); if (code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT) { @@ -2083,7 +2083,7 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function, type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index c5c1836..98ebeb2 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -442,9 +442,9 @@ score_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte * readbuf, const gdb_byte * writebuf) { - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY) return RETURN_VALUE_STRUCT_CONVENTION; else { @@ -469,7 +469,7 @@ score_return_value (struct gdbarch *gdbarch, struct value *function, static int score_type_needs_double_align (struct type *type) { - enum type_code typecode = TYPE_CODE (type); + enum type_code typecode = type->code (); if ((typecode == TYPE_CODE_INT && TYPE_LENGTH (type) == 8) || (typecode == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)) @@ -529,7 +529,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); const gdb_byte *val = value_contents (arg); int downward_offset = 0; int arg_last_part_p = 0; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 5b322ea..c6bef85 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -92,10 +92,10 @@ sh_is_renesas_calling_convention (struct type *func_type) { func_type = check_typedef (func_type); - if (TYPE_CODE (func_type) == TYPE_CODE_PTR) + if (func_type->code () == TYPE_CODE_PTR) func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); - if (TYPE_CODE (func_type) == TYPE_CODE_FUNC + if (func_type->code () == TYPE_CODE_FUNC && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh) val = 1; } @@ -816,8 +816,8 @@ sh_use_struct_convention (int renesas_abi, struct type *type) int nelem = TYPE_NFIELDS (type); /* The Renesas ABI returns aggregate types always on stack. */ - if (renesas_abi && (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION)) + if (renesas_abi && (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION)) return 1; /* Non-power of 2 length types and types bigger than 8 bytes (which don't @@ -1040,17 +1040,17 @@ static int sh_treat_as_flt_p (struct type *type) { /* Ordinary float types are obviously treated as float. */ - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) return 1; /* Otherwise non-struct types are not treated as float. */ - if (TYPE_CODE (type) != TYPE_CODE_STRUCT) + if (type->code () != TYPE_CODE_STRUCT) return 0; /* Otherwise structs with more than one member are not treated as float. */ if (TYPE_NFIELDS (type) != 1) return 0; /* Otherwise if the type of that member is float, the whole type is treated as float. */ - if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT) + if (TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_FLT) return 1; /* Otherwise it's not treated as float. */ return 0; @@ -1115,9 +1115,9 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, /* In Renesas ABI, long longs and aggregate types are always passed on stack. */ else if (sh_is_renesas_calling_convention (func_type) - && ((TYPE_CODE (type) == TYPE_CODE_INT && len == 8) - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION)) + && ((type->code () == TYPE_CODE_INT && len == 8) + || type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION)) pass_on_stack = 1; /* In contrast to non-FPU CPUs, arguments are never split between registers and stack. If an argument doesn't fit in the remaining @@ -1248,10 +1248,10 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, /* Renesas ABI pushes doubles and long longs entirely on stack. Same goes for aggregate types. */ if (sh_is_renesas_calling_convention (func_type) - && ((TYPE_CODE (type) == TYPE_CODE_INT && len >= 8) - || (TYPE_CODE (type) == TYPE_CODE_FLT && len >= 8) - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION)) + && ((type->code () == TYPE_CODE_INT && len >= 8) + || (type->code () == TYPE_CODE_FLT && len >= 8) + || type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION)) pass_on_stack = 1; while (len > 0) { diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index a0c4172..9e00a67 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -214,7 +214,7 @@ sparc_integral_or_pointer_p (const struct type *type) { int len = TYPE_LENGTH (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -242,7 +242,7 @@ sparc_integral_or_pointer_p (const struct type *type) static int sparc_floating_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: { @@ -261,7 +261,7 @@ sparc_floating_p (const struct type *type) static int sparc_complex_floating_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_COMPLEX: { @@ -284,7 +284,7 @@ sparc_complex_floating_p (const struct type *type) static int sparc_structure_or_union_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -303,7 +303,7 @@ sparc_structure_or_union_p (const struct type *type) static bool sparc_structure_return_p (const struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) { /* Float vectors are always returned by memory. */ if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type)))) @@ -331,7 +331,7 @@ sparc_structure_return_p (const struct type *type) static bool sparc_arg_by_memory_p (const struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) { /* Float vectors are always passed by memory. */ if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type)))) @@ -1228,7 +1228,7 @@ static int sparc32_struct_return_from_sym (struct symbol *sym) { struct type *type = check_typedef (SYMBOL_TYPE (sym)); - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) { @@ -1402,7 +1402,7 @@ sparc32_extract_return_value (struct type *type, struct regcache *regcache, gdb_assert (!sparc_structure_return_p (type)); if (sparc_floating_p (type) || sparc_complex_floating_p (type) - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + || type->code () == TYPE_CODE_ARRAY) { /* Floating return values. */ regcache->cooked_read (SPARC_F0_REGNUM, buf); diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 593db36..39ba455 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -550,7 +550,7 @@ _initialize_sparc64_adi_tdep () static int sparc64_integral_or_pointer_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: @@ -582,7 +582,7 @@ sparc64_integral_or_pointer_p (const struct type *type) static int sparc64_floating_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: { @@ -602,7 +602,7 @@ sparc64_floating_p (const struct type *type) static int sparc64_complex_floating_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_COMPLEX: { @@ -626,7 +626,7 @@ sparc64_complex_floating_p (const struct type *type) static int sparc64_structure_or_union_p (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -1165,7 +1165,7 @@ static const struct frame_base sparc64_frame_base = static int sparc64_16_byte_align_p (struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { struct type *t = check_typedef (TYPE_TARGET_TYPE (type)); @@ -1206,7 +1206,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, gdb_assert (element < 16); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { gdb_byte buf[8]; int regnum = SPARC_F0_REGNUM + element * 2 + bitpos / 32; @@ -1295,7 +1295,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, { struct gdbarch *gdbarch = regcache->arch (); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { int len = TYPE_LENGTH (type); int regnum = SPARC_F0_REGNUM + bitpos / 32; @@ -1656,7 +1656,7 @@ sparc64_extract_return_value (struct type *type, struct regcache *regcache, for (i = 0; i < ((len + 7) / 8); i++) regcache->cooked_read (SPARC_O0_REGNUM + i, buf + i * 8); - if (TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_UNION) sparc64_extract_floating_fields (regcache, type, buf, 0); memcpy (valbuf, buf, len); } @@ -1667,7 +1667,7 @@ sparc64_extract_return_value (struct type *type, struct regcache *regcache, regcache->cooked_read (SPARC_F0_REGNUM + i, buf + i * 4); memcpy (valbuf, buf, len); } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + else if (type->code () == TYPE_CODE_ARRAY) { /* Small arrays are returned the same way as small structures. */ gdb_assert (len <= 32); @@ -1711,7 +1711,7 @@ sparc64_store_return_value (struct type *type, struct regcache *regcache, memcpy (buf, valbuf, len); for (i = 0; i < ((len + 7) / 8); i++) regcache->cooked_write (SPARC_O0_REGNUM + i, buf + i * 8); - if (TYPE_CODE (type) != TYPE_CODE_UNION) + if (type->code () != TYPE_CODE_UNION) sparc64_store_floating_fields (regcache, type, buf, 0, 0); } else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type)) @@ -1721,7 +1721,7 @@ sparc64_store_return_value (struct type *type, struct regcache *regcache, for (i = 0; i < len / 4; i++) regcache->cooked_write (SPARC_F0_REGNUM + i, buf + i * 4); } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + else if (type->code () == TYPE_CODE_ARRAY) { /* Small arrays are returned the same way as small structures. */ gdb_assert (len <= 32); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 5601c80..77f105d 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -955,7 +955,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Function result types are described as the result type in stabs. We need to convert this to the function-returning-type-X type in GDB. E.g. "int" is converted to "function returning int". */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_FUNC) + if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_FUNC) SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym)); /* All functions in C++ have prototypes. Stabs does not offer an @@ -1004,7 +1004,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, a TYPE_CODE_VOID type by read_type, and we have to turn it back into builtin_int here. FIXME: Do we need a new builtin_promoted_int_arg ? */ - if (TYPE_CODE (ptype) == TYPE_CODE_VOID) + if (ptype->code () == TYPE_CODE_VOID) ptype = objfile_type (objfile)->builtin_int; TYPE_FIELD_TYPE (ftype, nparams) = ptype; TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0; @@ -1093,7 +1093,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, really an int. */ if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT - && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT) + && SYMBOL_TYPE (sym)->code () == TYPE_CODE_INT) { SYMBOL_TYPE (sym) = TYPE_UNSIGNED (SYMBOL_TYPE (sym)) @@ -1239,8 +1239,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, derived class was output. We fill in the derived class's base part member's name here in that case. */ if (TYPE_NAME (SYMBOL_TYPE (sym)) != NULL) - if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION) + if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT + || SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION) && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym))) { int j; @@ -1253,9 +1253,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL) { - if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR + if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR && strcmp (sym->linkage_name (), vtbl_ptr_name)) - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC) + || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to foo" or "function returning foo", we better not set @@ -1548,7 +1548,7 @@ read_type (const char **pp, struct objfile *objfile) /* If this is a forward reference, arrange to complain if it doesn't get patched up by the time we're done reading. */ - if (TYPE_CODE (type) == TYPE_CODE_UNDEF) + if (type->code () == TYPE_CODE_UNDEF) add_undefined_type (type, typenums); return type; @@ -1670,7 +1670,7 @@ again: if (SYMBOL_CLASS (sym) == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN - && (TYPE_CODE (SYMBOL_TYPE (sym)) == code) + && (SYMBOL_TYPE (sym)->code () == code) && strcmp (sym->linkage_name (), type_name) == 0) { obstack_free (&objfile->objfile_obstack, type_name); @@ -1835,7 +1835,7 @@ again: that's just an empty argument list. */ if (arg_types && ! arg_types->next - && TYPE_CODE (arg_types->type) == TYPE_CODE_VOID) + && arg_types->type->code () == TYPE_CODE_VOID) num_args = 0; TYPE_FIELDS (func_type) @@ -2369,10 +2369,10 @@ read_member_functions (struct stab_field_info *fip, const char **pp, } /* These are methods, not functions. */ - if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC) + if (new_sublist->fn_field.type->code () == TYPE_CODE_FUNC) new_sublist->fn_field.type->set_code (TYPE_CODE_METHOD); else - gdb_assert (TYPE_CODE (new_sublist->fn_field.type) + gdb_assert (new_sublist->fn_field.type->code () == TYPE_CODE_METHOD); /* If this is just a stub, then we don't have the real name here. */ @@ -2920,16 +2920,16 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, struct type *field_type = check_typedef (FIELD_TYPE (fip->list->field)); - if (TYPE_CODE (field_type) != TYPE_CODE_INT - && TYPE_CODE (field_type) != TYPE_CODE_RANGE - && TYPE_CODE (field_type) != TYPE_CODE_BOOL - && TYPE_CODE (field_type) != TYPE_CODE_ENUM) + if (field_type->code () != TYPE_CODE_INT + && field_type->code () != TYPE_CODE_RANGE + && field_type->code () != TYPE_CODE_BOOL + && field_type->code () != TYPE_CODE_ENUM) { FIELD_BITSIZE (fip->list->field) = 0; } if ((FIELD_BITSIZE (fip->list->field) == TARGET_CHAR_BIT * TYPE_LENGTH (field_type) - || (TYPE_CODE (field_type) == TYPE_CODE_ENUM + || (field_type->code () == TYPE_CODE_ENUM && FIELD_BITSIZE (fip->list->field) == gdbarch_int_bit (gdbarch)) ) @@ -3382,7 +3382,7 @@ complain_about_struct_wipeout (struct type *type) if (TYPE_NAME (type)) { name = TYPE_NAME (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: kind = "struct "; break; case TYPE_CODE_UNION: kind = "union "; break; @@ -3467,7 +3467,7 @@ read_struct_type (const char **pp, struct type *type, enum type_code type_code, Obviously, GDB can't fix this by itself, but it can at least avoid scribbling on existing structure type objects when new definitions appear. */ - if (! (TYPE_CODE (type) == TYPE_CODE_UNDEF + if (! (type->code () == TYPE_CODE_UNDEF || TYPE_STUB (type))) { complain_about_struct_wipeout (type); @@ -4231,7 +4231,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp, complaint (_("Invalid (empty) method arguments")); *varargsp = 0; } - else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID) + else if (types[n - 1]->code () != TYPE_CODE_VOID) *varargsp = 1; else { @@ -4429,7 +4429,7 @@ cleanup_undefined_types_noname (struct objfile *objfile) struct type **type; type = dbx_lookup_type (nat.typenums, objfile); - if (nat.type != *type && TYPE_CODE (*type) != TYPE_CODE_UNDEF) + if (nat.type != *type && (*type)->code () != TYPE_CODE_UNDEF) { /* The instance flags of the undefined type are still unset, and needs to be copied over from the reference type. @@ -4479,7 +4479,7 @@ cleanup_undefined_types_1 (void) for (type = undef_types; type < undef_types + undef_types_length; type++) { - switch (TYPE_CODE (*type)) + switch ((*type)->code ()) { case TYPE_CODE_STRUCT: @@ -4510,8 +4510,8 @@ cleanup_undefined_types_1 (void) if (SYMBOL_CLASS (sym) == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN - && (TYPE_CODE (SYMBOL_TYPE (sym)) == - TYPE_CODE (*type)) + && (SYMBOL_TYPE (sym)->code () == + (*type)->code ()) && (TYPE_INSTANCE_FLAGS (*type) == TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym))) && strcmp (sym->linkage_name (), type_name) == 0) @@ -4526,7 +4526,7 @@ cleanup_undefined_types_1 (void) { complaint (_("forward-referenced types left unresolved, " "type code %d."), - TYPE_CODE (*type)); + (*type)->code ()); } break; } diff --git a/gdb/stack.c b/gdb/stack.c index e8a9a92..f67a151 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2769,7 +2769,7 @@ return_command (const char *retval_exp, int from_tty) function = read_var_value (thisfun, NULL, thisframe); rv_conv = RETURN_VALUE_REGISTER_CONVENTION; - if (TYPE_CODE (return_type) == TYPE_CODE_VOID) + if (return_type->code () == TYPE_CODE_VOID) /* If the return-type is "void", don't try to find the return-value's location. However, do still evaluate the return expression so that, even when the expression result diff --git a/gdb/symmisc.c b/gdb/symmisc.c index a00009f..ebbedef 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -564,9 +564,9 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, else { fprintf_filtered (outfile, "%s %s = ", - (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_ENUM + (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_ENUM ? "enum" - : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT + : (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_STRUCT ? "struct" : "union")), symbol->linkage_name ()); LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth, @@ -583,7 +583,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, /* Print details of types, except for enums where it's clutter. */ LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (), outfile, - TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM, + SYMBOL_TYPE (symbol)->code () != TYPE_CODE_ENUM, depth, &type_print_raw_options); fprintf_filtered (outfile, "; "); diff --git a/gdb/symtab.c b/gdb/symtab.c index b765a58..2043d08 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2062,11 +2062,11 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type, /* I'm not really sure that type of this can ever be typedefed; just be safe. */ t = check_typedef (t); - if (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + if (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) t = TYPE_TARGET_TYPE (t); - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION) error (_("Internal error: `%s' is not an aggregate"), langdef->la_name_of_this); @@ -4652,7 +4652,7 @@ global_symbol_searcher::add_matching_symbols members. We only want to skip enums here. */ && !(SYMBOL_CLASS (sym) == LOC_CONST - && (TYPE_CODE (SYMBOL_TYPE (sym)) + && (SYMBOL_TYPE (sym)->code () == TYPE_CODE_ENUM)) && (!treg.has_value () || treg_matches_sym_type_name (*treg, sym))) @@ -4858,7 +4858,7 @@ symbol_to_info_string (struct symbol *sym, int block, For the struct printing case below, things are worse, we force printing of the ";" in this function, which is going to be wrong for languages that don't require a ";" between statements. */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_TYPEDEF) + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_TYPEDEF) typedef_print (SYMBOL_TYPE (sym), sym, &tmp_stream); else type_print (SYMBOL_TYPE (sym), "", &tmp_stream, -1); @@ -5484,7 +5484,7 @@ completion_list_add_fields (completion_tracker &tracker, if (SYMBOL_CLASS (sym) == LOC_TYPEDEF) { struct type *t = SYMBOL_TYPE (sym); - enum type_code c = TYPE_CODE (t); + enum type_code c = t->code (); int j; if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT) @@ -5501,7 +5501,7 @@ completion_list_add_fields (completion_tracker &tracker, bool symbol_is_function_or_method (symbol *sym) { - switch (TYPE_CODE (SYMBOL_TYPE (sym))) + switch (SYMBOL_TYPE (sym)->code ()) { case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: @@ -5601,7 +5601,7 @@ add_symtab_completions (struct compunit_symtab *cust, if (code == TYPE_CODE_UNDEF || (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN - && TYPE_CODE (SYMBOL_TYPE (sym)) == code)) + && SYMBOL_TYPE (sym)->code () == code)) completion_list_add_symbol (tracker, sym, lookup_name, text, word); @@ -5752,7 +5752,7 @@ default_collect_symbol_completion_matches_break_on sym_text, word); } else if (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN - && TYPE_CODE (SYMBOL_TYPE (sym)) == code) + && SYMBOL_TYPE (sym)->code () == code) completion_list_add_symbol (tracker, sym, lookup_name, sym_text, word); } diff --git a/gdb/target-float.c b/gdb/target-float.c index 1bdd3ef..83ef98a 100644 --- a/gdb/target-float.c +++ b/gdb/target-float.c @@ -1742,7 +1742,7 @@ mpfr_float_ops::compare (const gdb_byte *x, const struct type *type_x, static void match_endianness (const gdb_byte *from, const struct type *type, gdb_byte *to) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_DECFLOAT); + gdb_assert (type->code () == TYPE_CODE_DECFLOAT); int len = TYPE_LENGTH (type); int i; @@ -1768,7 +1768,7 @@ match_endianness (const gdb_byte *from, const struct type *type, gdb_byte *to) static void set_decnumber_context (decContext *ctx, const struct type *type) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_DECFLOAT); + gdb_assert (type->code () == TYPE_CODE_DECFLOAT); switch (TYPE_LENGTH (type)) { @@ -2142,7 +2142,7 @@ static bool target_float_same_category_p (const struct type *type1, const struct type *type2) { - return TYPE_CODE (type1) == TYPE_CODE (type2); + return type1->code () == type2->code (); } /* Return whether TYPE1 and TYPE2 use the same floating-point format. */ @@ -2153,7 +2153,7 @@ target_float_same_format_p (const struct type *type1, if (!target_float_same_category_p (type1, type2)) return false; - switch (TYPE_CODE (type1)) + switch (type1->code ()) { case TYPE_CODE_FLT: return floatformat_from_type (type1) == floatformat_from_type (type2); @@ -2173,7 +2173,7 @@ target_float_same_format_p (const struct type *type1, static int target_float_format_length (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: return floatformat_totalsize_bytes (floatformat_from_type (type)); @@ -2205,7 +2205,7 @@ enum target_float_ops_kind static enum target_float_ops_kind get_target_float_ops_kind (const struct type *type) { - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_FLT: { @@ -2300,7 +2300,7 @@ get_target_float_ops (const struct type *type) static const target_float_ops * get_target_float_ops (const struct type *type1, const struct type *type2) { - gdb_assert (TYPE_CODE (type1) == TYPE_CODE (type2)); + gdb_assert (type1->code () == type2->code ()); enum target_float_ops_kind kind1 = get_target_float_ops_kind (type1); enum target_float_ops_kind kind2 = get_target_float_ops_kind (type2); @@ -2315,10 +2315,10 @@ get_target_float_ops (const struct type *type1, const struct type *type2) bool target_float_is_valid (const gdb_byte *addr, const struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) return floatformat_is_valid (floatformat_from_type (type), addr); - if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + if (type->code () == TYPE_CODE_DECFLOAT) return true; gdb_assert_not_reached ("unexpected type code"); @@ -2329,11 +2329,11 @@ target_float_is_valid (const gdb_byte *addr, const struct type *type) bool target_float_is_zero (const gdb_byte *addr, const struct type *type) { - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (type->code () == TYPE_CODE_FLT) return (floatformat_classify (floatformat_from_type (type), addr) == float_zero); - if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + if (type->code () == TYPE_CODE_DECFLOAT) return decimal_is_zero (addr, type); gdb_assert_not_reached ("unexpected type code"); @@ -2347,7 +2347,7 @@ target_float_to_string (const gdb_byte *addr, const struct type *type, { /* Unless we need to adhere to a specific format, provide special output for special cases of binary floating-point numbers. */ - if (format == nullptr && TYPE_CODE (type) == TYPE_CODE_FLT) + if (format == nullptr && type->code () == TYPE_CODE_FLT) { const struct floatformat *fmt = floatformat_from_type (type); diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c index 50031c1..eb97015 100644 --- a/gdb/tic6x-tdep.c +++ b/gdb/tic6x-tdep.c @@ -808,7 +808,7 @@ static int tic6x_arg_type_alignment (struct type *type) { int len = TYPE_LENGTH (check_typedef (type)); - enum type_code typecode = TYPE_CODE (check_typedef (type)); + enum type_code typecode = check_typedef (type)->code (); if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) { @@ -881,11 +881,11 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Determine the type of this function. */ func_type = check_typedef (func_type); - if (TYPE_CODE (func_type) == TYPE_CODE_PTR) + if (func_type->code () == TYPE_CODE_PTR) func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); - gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC - || TYPE_CODE (func_type) == TYPE_CODE_METHOD); + gdb_assert (func_type->code () == TYPE_CODE_FUNC + || func_type->code () == TYPE_CODE_METHOD); /* For a variadic C function, the last explicitly declared argument and all remaining arguments are passed on the stack. */ @@ -915,7 +915,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); + enum type_code typecode = arg_type->code (); val = value_contents (arg); diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index 70c4add..4e46d09 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -188,9 +188,9 @@ tilegx_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num) static int tilegx_type_is_scalar (struct type *t) { - return (TYPE_CODE(t) != TYPE_CODE_STRUCT - && TYPE_CODE(t) != TYPE_CODE_UNION - && TYPE_CODE(t) != TYPE_CODE_ARRAY); + return (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION + && t->code () != TYPE_CODE_ARRAY); } /* Returns non-zero if the given struct type will be returned using diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index aa6bea4..2e0f0df 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -942,7 +942,7 @@ collection_list::collect_symbol (struct symbol *sym, } /* A struct may be a C++ class with static fields, go to general expression handling. */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT) + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT) treat_as_expr = 1; else add_memrange (gdbarch, memrange_absolute, offset, len, scope); @@ -954,7 +954,7 @@ collection_list::collect_symbol (struct symbol *sym, add_local_register (gdbarch, reg, scope); /* Check for doubles stored in two registers. */ /* FIXME: how about larger types stored in 3 or more regs? */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT && + if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_FLT && len > register_size (gdbarch, reg)) add_local_register (gdbarch, reg + 1, scope); break; diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 87da8e3..e5009ea 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -117,7 +117,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx, } struct type *ftype = check_typedef (TYPE_FIELD_TYPE (type, field_idx)); - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) { /* Since union fields don't have the concept of offsets, we just print their sizes. */ @@ -515,7 +515,7 @@ whatis_exp (const char *exp, int show) Use check_typedef to resolve stubs, but ignore its result because we do not want to dig past all typedefs. */ check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (type->code () == TYPE_CODE_TYPEDEF) type = TYPE_TARGET_TYPE (type); /* If the expression is actually a type, then there's no @@ -540,16 +540,16 @@ whatis_exp (const char *exp, int show) get_user_print_options (&opts); if (val != NULL && opts.objectprint) { - if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type)) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) + if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type)) + && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) real_type = value_rtti_indirect_type (val, &full, &top, &using_enc); - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) + else if (type->code () == TYPE_CODE_STRUCT) real_type = value_rtti_type (val, &full, &top, &using_enc); } if (flags.print_offsets - && (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION)) + && (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION)) fprintf_filtered (gdb_stdout, "/* offset | size */ "); printf_filtered ("type = "); @@ -615,7 +615,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream) type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ENUM: diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index fd5a9ff..1e0fd41 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -498,9 +498,9 @@ v850_register_type (struct gdbarch *gdbarch, int regnum) static int v850_type_is_scalar (struct type *t) { - return (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION - && TYPE_CODE (t) != TYPE_CODE_ARRAY); + return (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION + && t->code () != TYPE_CODE_ARRAY); } /* Should call_function allocate stack space for a struct return? */ @@ -530,15 +530,15 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type) /* The value is a structure or union with a single element and that element is either a single basic type or an array of a single basic type whose size is greater than or equal to 4 -> returned in register. */ - if ((TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) + if ((type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION) && TYPE_NFIELDS (type) == 1) { fld_type = TYPE_FIELD_TYPE (type, 0); if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4) return 0; - if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY) + if (fld_type->code () == TYPE_CODE_ARRAY) { tgt_type = TYPE_TARGET_TYPE (fld_type); if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4) @@ -549,14 +549,14 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type) /* The value is a structure whose first element is an integer or a float, and which contains no arrays of more than two elements -> returned in register. */ - if (TYPE_CODE (type) == TYPE_CODE_STRUCT + if (type->code () == TYPE_CODE_STRUCT && v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0)) && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4) { for (i = 1; i < TYPE_NFIELDS (type); ++i) { fld_type = TYPE_FIELD_TYPE (type, 0); - if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY) + if (fld_type->code () == TYPE_CODE_ARRAY) { tgt_type = TYPE_TARGET_TYPE (fld_type); if (TYPE_LENGTH (tgt_type) > 0 @@ -570,7 +570,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type) /* The value is a union which contains at least one field which would be returned in registers according to these rules -> returned in register. */ - if (TYPE_CODE (type) == TYPE_CODE_UNION) + if (type->code () == TYPE_CODE_UNION) { for (i = 0; i < TYPE_NFIELDS (type); ++i) { diff --git a/gdb/valarith.c b/gdb/valarith.c index 504264b..f1e1d6e 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -48,13 +48,13 @@ find_size_for_pointer_math (struct type *ptr_type) LONGEST sz = -1; struct type *ptr_target; - gdb_assert (TYPE_CODE (ptr_type) == TYPE_CODE_PTR); + gdb_assert (ptr_type->code () == TYPE_CODE_PTR); ptr_target = check_typedef (TYPE_TARGET_TYPE (ptr_type)); sz = type_length_units (ptr_target); if (sz == 0) { - if (TYPE_CODE (ptr_type) == TYPE_CODE_VOID) + if (ptr_type->code () == TYPE_CODE_VOID) sz = 1; else { @@ -107,8 +107,8 @@ value_ptrdiff (struct value *arg1, struct value *arg2) type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - gdb_assert (TYPE_CODE (type1) == TYPE_CODE_PTR); - gdb_assert (TYPE_CODE (type2) == TYPE_CODE_PTR); + gdb_assert (type1->code () == TYPE_CODE_PTR); + gdb_assert (type2->code () == TYPE_CODE_PTR); if (TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1))) != TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type2)))) @@ -146,8 +146,8 @@ value_subscript (struct value *array, LONGEST index) array = coerce_ref (array); tarray = check_typedef (value_type (array)); - if (TYPE_CODE (tarray) == TYPE_CODE_ARRAY - || TYPE_CODE (tarray) == TYPE_CODE_STRING) + if (tarray->code () == TYPE_CODE_ARRAY + || tarray->code () == TYPE_CODE_STRING) { struct type *range_type = TYPE_INDEX_TYPE (tarray); LONGEST lowerbound, upperbound; @@ -248,8 +248,8 @@ binop_types_user_defined_p (enum exp_opcode op, if (TYPE_IS_REFERENCE (type2)) type2 = check_typedef (TYPE_TARGET_TYPE (type2)); - return (TYPE_CODE (type1) == TYPE_CODE_STRUCT - || TYPE_CODE (type2) == TYPE_CODE_STRUCT); + return (type1->code () == TYPE_CODE_STRUCT + || type2->code () == TYPE_CODE_STRUCT); } /* Check to see if either argument is a structure, or a reference to @@ -281,7 +281,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1) type1 = check_typedef (value_type (arg1)); if (TYPE_IS_REFERENCE (type1)) type1 = check_typedef (TYPE_TARGET_TYPE (type1)); - return TYPE_CODE (type1) == TYPE_CODE_STRUCT; + return type1->code () == TYPE_CODE_STRUCT; } /* Try to find an operator named OPERATOR which takes NARGS arguments @@ -364,7 +364,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, /* now we know that what we have to do is construct our arg vector and find the right function to call it with. */ - if (TYPE_CODE (check_typedef (value_type (arg1))) != TYPE_CODE_STRUCT) + if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT) error (_("Can't do that binary op on that type")); /* FIXME be explicit */ value *argvec_storage[3]; @@ -491,7 +491,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, argvec[1] = argvec[0]; argvec = argvec.slice (1); } - if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD) + if (value_type (argvec[0])->code () == TYPE_CODE_XMETHOD) { /* Static xmethods are not supported yet. */ gdb_assert (static_memfuncp == 0); @@ -540,7 +540,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) /* now we know that what we have to do is construct our arg vector and find the right function to call it with. */ - if (TYPE_CODE (check_typedef (value_type (arg1))) != TYPE_CODE_STRUCT) + if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT) error (_("Can't do that unary op on that type")); /* FIXME be explicit */ value *argvec_storage[3]; @@ -605,7 +605,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) argvec[1] = argvec[0]; argvec = argvec.slice (1); } - if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD) + if (value_type (argvec[0])->code () == TYPE_CODE_XMETHOD) { /* Static xmethods are not supported yet. */ gdb_assert (static_memfuncp == 0); @@ -675,7 +675,7 @@ value_concat (struct value *arg1, struct value *arg2) to the second of the two concatenated values or the value to be repeated. */ - if (TYPE_CODE (type2) == TYPE_CODE_INT) + if (type2->code () == TYPE_CODE_INT) { struct type *tmp = type1; @@ -692,17 +692,17 @@ value_concat (struct value *arg1, struct value *arg2) /* Now process the input values. */ - if (TYPE_CODE (type1) == TYPE_CODE_INT) + if (type1->code () == TYPE_CODE_INT) { /* We have a repeat count. Validate the second value and then construct a value repeated that many times. */ - if (TYPE_CODE (type2) == TYPE_CODE_STRING - || TYPE_CODE (type2) == TYPE_CODE_CHAR) + if (type2->code () == TYPE_CODE_STRING + || type2->code () == TYPE_CODE_CHAR) { count = longest_to_int (value_as_long (inval1)); inval2len = TYPE_LENGTH (type2); std::vector<char> ptr (count * inval2len); - if (TYPE_CODE (type2) == TYPE_CODE_CHAR) + if (type2->code () == TYPE_CODE_CHAR) { char_type = type2; @@ -725,7 +725,7 @@ value_concat (struct value *arg1, struct value *arg2) } outval = value_string (ptr.data (), count * inval2len, char_type); } - else if (TYPE_CODE (type2) == TYPE_CODE_BOOL) + else if (type2->code () == TYPE_CODE_BOOL) { error (_("unimplemented support for boolean repeats")); } @@ -734,19 +734,19 @@ value_concat (struct value *arg1, struct value *arg2) error (_("can't repeat values of that type")); } } - else if (TYPE_CODE (type1) == TYPE_CODE_STRING - || TYPE_CODE (type1) == TYPE_CODE_CHAR) + else if (type1->code () == TYPE_CODE_STRING + || type1->code () == TYPE_CODE_CHAR) { /* We have two character strings to concatenate. */ - if (TYPE_CODE (type2) != TYPE_CODE_STRING - && TYPE_CODE (type2) != TYPE_CODE_CHAR) + if (type2->code () != TYPE_CODE_STRING + && type2->code () != TYPE_CODE_CHAR) { error (_("Strings can only be concatenated with other strings.")); } inval1len = TYPE_LENGTH (type1); inval2len = TYPE_LENGTH (type2); std::vector<char> ptr (inval1len + inval2len); - if (TYPE_CODE (type1) == TYPE_CODE_CHAR) + if (type1->code () == TYPE_CODE_CHAR) { char_type = type1; @@ -758,7 +758,7 @@ value_concat (struct value *arg1, struct value *arg2) memcpy (ptr.data (), value_contents (inval1), inval1len); } - if (TYPE_CODE (type2) == TYPE_CODE_CHAR) + if (type2->code () == TYPE_CODE_CHAR) { ptr[inval1len] = (char) unpack_long (type2, value_contents (inval2)); @@ -769,10 +769,10 @@ value_concat (struct value *arg1, struct value *arg2) } outval = value_string (ptr.data (), inval1len + inval2len, char_type); } - else if (TYPE_CODE (type1) == TYPE_CODE_BOOL) + else if (type1->code () == TYPE_CODE_BOOL) { /* We have two bitstrings to concatenate. */ - if (TYPE_CODE (type2) != TYPE_CODE_BOOL) + if (type2->code () != TYPE_CODE_BOOL) { error (_("Booleans can only be concatenated " "with other bitstrings or booleans.")); @@ -865,7 +865,7 @@ value_args_as_target_float (struct value *arg1, struct value *arg2, gdb_assert (is_floating_type (type1) || is_floating_type (type2)); if (is_floating_type (type1) && is_floating_type (type2) - && TYPE_CODE (type1) != TYPE_CODE (type2)) + && type1->code () != type2->code ()) /* The DFP extension to the C language does not allow mixing of * decimal float types with other float types in expressions * (see WDTR 24732, page 12). */ @@ -962,7 +962,7 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) struct type *arg2_type = check_typedef (value_type (arg2)); struct value *arg1_real, *arg1_imag, *arg2_real, *arg2_imag; - if (TYPE_CODE (arg1_type) == TYPE_CODE_COMPLEX) + if (arg1_type->code () == TYPE_CODE_COMPLEX) { arg1_real = value_real_part (arg1); arg1_imag = value_imaginary_part (arg1); @@ -972,7 +972,7 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) arg1_real = arg1; arg1_imag = value_zero (arg1_type, not_lval); } - if (TYPE_CODE (arg2_type) == TYPE_CODE_COMPLEX) + if (arg2_type->code () == TYPE_CODE_COMPLEX) { arg2_real = value_real_part (arg2); arg2_imag = value_imaginary_part (arg2); @@ -1015,7 +1015,7 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) case BINOP_DIV: { - if (TYPE_CODE (arg2_type) == TYPE_CODE_COMPLEX) + if (arg2_type->code () == TYPE_CODE_COMPLEX) { struct value *conjugate = value_complement (arg2); /* We have to reconstruct ARG1, in case the type was @@ -1080,8 +1080,8 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - if (TYPE_CODE (type1) == TYPE_CODE_COMPLEX - || TYPE_CODE (type2) == TYPE_CODE_COMPLEX) + if (type1->code () == TYPE_CODE_COMPLEX + || type2->code () == TYPE_CODE_COMPLEX) return complex_binop (arg1, arg2, op); if ((!is_floating_value (arg1) && !is_integral_type (type1)) @@ -1105,8 +1105,8 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) v2.data (), eff_type_v2, value_contents_raw (val), result_type); } - else if (TYPE_CODE (type1) == TYPE_CODE_BOOL - || TYPE_CODE (type2) == TYPE_CODE_BOOL) + else if (type1->code () == TYPE_CODE_BOOL + || type2->code () == TYPE_CODE_BOOL) { LONGEST v1, v2, v = 0; @@ -1438,7 +1438,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type) vector_type = check_typedef (vector_type); - gdb_assert (TYPE_CODE (vector_type) == TYPE_CODE_ARRAY + gdb_assert (vector_type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (vector_type)); if (!get_array_bounds (vector_type, &low_bound, &high_bound)) @@ -1478,9 +1478,9 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op) type1 = check_typedef (value_type (val1)); type2 = check_typedef (value_type (val2)); - t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY + t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) ? 1 : 0; - t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY + t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)) ? 1 : 0; if (!t1_is_vec || !t2_is_vec) @@ -1494,7 +1494,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op) eltype2 = check_typedef (TYPE_TARGET_TYPE (type2)); elsize = TYPE_LENGTH (eltype1); - if (TYPE_CODE (eltype1) != TYPE_CODE (eltype2) + if (eltype1->code () != eltype2->code () || elsize != TYPE_LENGTH (eltype2) || TYPE_UNSIGNED (eltype1) != TYPE_UNSIGNED (eltype2) || low_bound1 != low_bound2 || high_bound1 != high_bound2) @@ -1523,9 +1523,9 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) struct value *val; struct type *type1 = check_typedef (value_type (arg1)); struct type *type2 = check_typedef (value_type (arg2)); - int t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY + int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)); - int t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY + int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)); if (!t1_is_vec && !t2_is_vec) @@ -1538,8 +1538,8 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) struct value **v = t1_is_vec ? &arg2 : &arg1; struct type *t = t1_is_vec ? type2 : type1; - if (TYPE_CODE (t) != TYPE_CODE_FLT - && TYPE_CODE (t) != TYPE_CODE_DECFLOAT + if (t->code () != TYPE_CODE_FLT + && t->code () != TYPE_CODE_DECFLOAT && !is_integral_type (t)) error (_("Argument to operation not a number or boolean.")); @@ -1628,8 +1628,8 @@ value_equal (struct value *arg1, struct value *arg2) type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - code1 = TYPE_CODE (type1); - code2 = TYPE_CODE (type2); + code1 = type1->code (); + code2 = type2->code (); is_int1 = is_integral_type (type1); is_int2 = is_integral_type (type2); @@ -1692,7 +1692,7 @@ value_equal_contents (struct value *arg1, struct value *arg2) type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - return (TYPE_CODE (type1) == TYPE_CODE (type2) + return (type1->code () == type2->code () && TYPE_LENGTH (type1) == TYPE_LENGTH (type2) && memcmp (value_contents (arg1), value_contents (arg2), TYPE_LENGTH (type1)) == 0); @@ -1714,8 +1714,8 @@ value_less (struct value *arg1, struct value *arg2) type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - code1 = TYPE_CODE (type1); - code2 = TYPE_CODE (type2); + code1 = type1->code (); + code2 = type2->code (); is_int1 = is_integral_type (type1); is_int2 = is_integral_type (type2); @@ -1766,8 +1766,8 @@ value_pos (struct value *arg1) type = check_typedef (value_type (arg1)); if (is_integral_type (type) || is_floating_value (arg1) - || (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) - || TYPE_CODE (type) == TYPE_CODE_COMPLEX) + || (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + || type->code () == TYPE_CODE_COMPLEX) return value_from_contents (type, value_contents (arg1)); else error (_("Argument to positive operation not a number.")); @@ -1783,7 +1783,7 @@ value_neg (struct value *arg1) if (is_integral_type (type) || is_floating_type (type)) return value_binop (value_from_longest (type, 0), arg1, BINOP_SUB); - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) { struct value *tmp, *val = allocate_value (type); struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); @@ -1801,7 +1801,7 @@ value_neg (struct value *arg1) } return val; } - else if (TYPE_CODE (type) == TYPE_CODE_COMPLEX) + else if (type->code () == TYPE_CODE_COMPLEX) { struct value *real = value_real_part (arg1); struct value *imag = value_imaginary_part (arg1); @@ -1825,7 +1825,7 @@ value_complement (struct value *arg1) if (is_integral_type (type)) val = value_from_longest (type, ~value_as_long (arg1)); - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) { struct value *tmp; struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); @@ -1843,7 +1843,7 @@ value_complement (struct value *arg1) value_contents_all (tmp), TYPE_LENGTH (eltype)); } } - else if (TYPE_CODE (type) == TYPE_CODE_COMPLEX) + else if (type->code () == TYPE_CODE_COMPLEX) { /* GCC has an extension that treats ~complex as the complex conjugate. */ @@ -1892,14 +1892,14 @@ value_in (struct value *element, struct value *set) struct type *settype = check_typedef (value_type (set)); struct type *eltype = check_typedef (value_type (element)); - if (TYPE_CODE (eltype) == TYPE_CODE_RANGE) + if (eltype->code () == TYPE_CODE_RANGE) eltype = TYPE_TARGET_TYPE (eltype); - if (TYPE_CODE (settype) != TYPE_CODE_SET) + if (settype->code () != TYPE_CODE_SET) error (_("Second argument of 'IN' has wrong type")); - if (TYPE_CODE (eltype) != TYPE_CODE_INT - && TYPE_CODE (eltype) != TYPE_CODE_CHAR - && TYPE_CODE (eltype) != TYPE_CODE_ENUM - && TYPE_CODE (eltype) != TYPE_CODE_BOOL) + if (eltype->code () != TYPE_CODE_INT + && eltype->code () != TYPE_CODE_CHAR + && eltype->code () != TYPE_CODE_ENUM + && eltype->code () != TYPE_CODE_BOOL) error (_("First argument of 'IN' has wrong type")); member = value_bit_index (settype, value_contents (set), value_as_long (element)); diff --git a/gdb/valops.c b/gdb/valops.c index 2e7abf5..5e29482 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -215,11 +215,11 @@ value_cast_structs (struct type *type, struct value *v2) t2 = check_typedef (value_type (v2)); /* Check preconditions. */ - gdb_assert ((TYPE_CODE (t1) == TYPE_CODE_STRUCT - || TYPE_CODE (t1) == TYPE_CODE_UNION) + gdb_assert ((t1->code () == TYPE_CODE_STRUCT + || t1->code () == TYPE_CODE_UNION) && !!"Precondition is that type is of STRUCT or UNION kind."); - gdb_assert ((TYPE_CODE (t2) == TYPE_CODE_STRUCT - || TYPE_CODE (t2) == TYPE_CODE_UNION) + gdb_assert ((t2->code () == TYPE_CODE_STRUCT + || t2->code () == TYPE_CODE_UNION) && !!"Precondition is that value is of STRUCT or UNION kind"); if (TYPE_NAME (t1) != NULL @@ -300,8 +300,8 @@ value_cast_pointers (struct type *type, struct value *arg2, struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1)); struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2)); - if (TYPE_CODE (t1) == TYPE_CODE_STRUCT - && TYPE_CODE (t2) == TYPE_CODE_STRUCT + if (t1->code () == TYPE_CODE_STRUCT + && t2->code () == TYPE_CODE_STRUCT && (subclass_check || !value_logical_not (arg2))) { struct value *v2; @@ -310,7 +310,7 @@ value_cast_pointers (struct type *type, struct value *arg2, v2 = coerce_ref (arg2); else v2 = value_ind (arg2); - gdb_assert (TYPE_CODE (check_typedef (value_type (v2))) + gdb_assert (check_typedef (value_type (v2))->code () == TYPE_CODE_STRUCT && !!"Why did coercion fail?"); v2 = value_cast_structs (t1, v2); /* At this point we have what we can have, un-dereference if needed. */ @@ -359,7 +359,7 @@ value_cast (struct type *type, struct value *arg2) struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1)); struct value *val = value_cast (dereftype, arg2); - return value_ref (val, TYPE_CODE (t1)); + return value_ref (val, t1->code ()); } if (TYPE_IS_REFERENCE (check_typedef (value_type (arg2)))) @@ -372,7 +372,7 @@ value_cast (struct type *type, struct value *arg2) struct type *to_type = type; type = check_typedef (type); - code1 = TYPE_CODE (type); + code1 = type->code (); arg2 = coerce_ref (arg2); type2 = check_typedef (value_type (arg2)); @@ -415,15 +415,15 @@ value_cast (struct type *type, struct value *arg2) } if (current_language->c_style_arrays - && TYPE_CODE (type2) == TYPE_CODE_ARRAY + && type2->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (type2)) arg2 = value_coerce_array (arg2); - if (TYPE_CODE (type2) == TYPE_CODE_FUNC) + if (type2->code () == TYPE_CODE_FUNC) arg2 = value_coerce_function (arg2); type2 = check_typedef (value_type (arg2)); - code2 = TYPE_CODE (type2); + code2 = type2->code (); if (code1 == TYPE_CODE_COMPLEX) return cast_into_complex (to_type, arg2); @@ -590,8 +590,8 @@ value_reinterpret_cast (struct type *type, struct value *arg) arg_type = value_type (arg); - dest_code = TYPE_CODE (real_type); - arg_code = TYPE_CODE (arg_type); + dest_code = real_type->code (); + arg_code = arg_type->code (); /* We can convert pointer types, or any pointer type to int, or int type to pointer. */ @@ -611,7 +611,7 @@ value_reinterpret_cast (struct type *type, struct value *arg) if (is_ref) result = value_cast (type, value_ref (value_ind (result), - TYPE_CODE (type))); + type->code ())); return result; } @@ -722,24 +722,24 @@ value_dynamic_cast (struct type *type, struct value *arg) CORE_ADDR addr; int is_ref = TYPE_IS_REFERENCE (resolved_type); - if (TYPE_CODE (resolved_type) != TYPE_CODE_PTR + if (resolved_type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (resolved_type)) error (_("Argument to dynamic_cast must be a pointer or reference type")); - if (TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_VOID - && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_STRUCT) + if (TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_VOID + && TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_STRUCT) error (_("Argument to dynamic_cast must be pointer to class or `void *'")); class_type = check_typedef (TYPE_TARGET_TYPE (resolved_type)); - if (TYPE_CODE (resolved_type) == TYPE_CODE_PTR) + if (resolved_type->code () == TYPE_CODE_PTR) { - if (TYPE_CODE (arg_type) != TYPE_CODE_PTR - && ! (TYPE_CODE (arg_type) == TYPE_CODE_INT + if (arg_type->code () != TYPE_CODE_PTR + && ! (arg_type->code () == TYPE_CODE_INT && value_as_long (arg) == 0)) error (_("Argument to dynamic_cast does not have pointer type")); - if (TYPE_CODE (arg_type) == TYPE_CODE_PTR) + if (arg_type->code () == TYPE_CODE_PTR) { arg_type = check_typedef (TYPE_TARGET_TYPE (arg_type)); - if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT) + if (arg_type->code () != TYPE_CODE_STRUCT) error (_("Argument to dynamic_cast does " "not have pointer to class type")); } @@ -752,7 +752,7 @@ value_dynamic_cast (struct type *type, struct value *arg) } else { - if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT) + if (arg_type->code () != TYPE_CODE_STRUCT) error (_("Argument to dynamic_cast does not have class type")); } @@ -786,8 +786,8 @@ value_dynamic_cast (struct type *type, struct value *arg) /* dynamic_cast<void *> means to return a pointer to the most-derived object. */ - if (TYPE_CODE (resolved_type) == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) == TYPE_CODE_VOID) + if (resolved_type->code () == TYPE_CODE_PTR + && TYPE_TARGET_TYPE (resolved_type)->code () == TYPE_CODE_VOID) return value_at_lazy (type, addr); tem = value_at (type, addr); @@ -808,7 +808,7 @@ value_dynamic_cast (struct type *type, struct value *arg) &result) == 1) return value_cast (type, is_ref - ? value_ref (result, TYPE_CODE (resolved_type)) + ? value_ref (result, resolved_type->code ()) : value_addr (result)); } @@ -822,10 +822,10 @@ value_dynamic_cast (struct type *type, struct value *arg) rtti_type, &result) == 1) return value_cast (type, is_ref - ? value_ref (result, TYPE_CODE (resolved_type)) + ? value_ref (result, resolved_type->code ()) : value_addr (result)); - if (TYPE_CODE (resolved_type) == TYPE_CODE_PTR) + if (resolved_type->code () == TYPE_CODE_PTR) return value_zero (type, not_lval); error (_("dynamic_cast failed")); @@ -854,7 +854,7 @@ value_one (struct type *type) { val = value_from_longest (type, (LONGEST) 1); } - else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + else if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) { struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1)); int i; @@ -893,7 +893,7 @@ get_value_at (struct type *type, CORE_ADDR addr, int lazy) { struct value *val; - if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID) + if (check_typedef (type)->code () == TYPE_CODE_VOID) error (_("Attempt to dereference a generic pointer.")); val = value_from_contents_and_address (type, NULL, addr); @@ -1249,7 +1249,7 @@ value_assign (struct value *toval, struct value *fromval) in the case of pointer types. For object types, the enclosing type and embedded offset must *not* be copied: the target object refered to by TOVAL retains its original dynamic type after assignment. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { set_value_enclosing_type (val, value_enclosing_type (fromval)); set_value_pointed_to_offset (val, value_pointed_to_offset (fromval)); @@ -1306,7 +1306,7 @@ address_of_variable (struct symbol *var, const struct block *b) type = value_type (val); if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) - || TYPE_CODE (type) == TYPE_CODE_FUNC) + || type->code () == TYPE_CODE_FUNC) { CORE_ADDR addr = value_address (val); @@ -1358,7 +1358,7 @@ value_must_coerce_to_target (struct value *val) valtype = check_typedef (value_type (val)); - switch (TYPE_CODE (valtype)) + switch (valtype->code ()) { case TYPE_CODE_ARRAY: return TYPE_VECTOR (valtype) ? 0 : 1; @@ -1478,7 +1478,7 @@ value_addr (struct value *arg1) return arg2; } } - if (TYPE_CODE (type) == TYPE_CODE_FUNC) + if (type->code () == TYPE_CODE_FUNC) return value_coerce_function (arg1); /* If this is an array that has not yet been pushed to the target, @@ -1514,9 +1514,9 @@ value_ref (struct value *arg1, enum type_code refcode) gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF); - if ((TYPE_CODE (type) == TYPE_CODE_REF - || TYPE_CODE (type) == TYPE_CODE_RVALUE_REF) - && TYPE_CODE (type) == refcode) + if ((type->code () == TYPE_CODE_REF + || type->code () == TYPE_CODE_RVALUE_REF) + && type->code () == refcode) return arg1; arg2 = value_addr (arg1); @@ -1550,7 +1550,7 @@ value_ind (struct value *arg1) } } - if (TYPE_CODE (base_type) == TYPE_CODE_PTR) + if (base_type->code () == TYPE_CODE_PTR) { struct type *enc_type; @@ -1559,8 +1559,8 @@ value_ind (struct value *arg1) enc_type = check_typedef (value_enclosing_type (arg1)); enc_type = TYPE_TARGET_TYPE (enc_type); - if (TYPE_CODE (check_typedef (enc_type)) == TYPE_CODE_FUNC - || TYPE_CODE (check_typedef (enc_type)) == TYPE_CODE_METHOD) + if (check_typedef (enc_type)->code () == TYPE_CODE_FUNC + || check_typedef (enc_type)->code () == TYPE_CODE_METHOD) /* For functions, go through find_function_addr, which knows how to handle function descriptors. */ arg2 = value_at_lazy (enc_type, @@ -1707,7 +1707,7 @@ typecmp (int staticp, int varargs, int nargs, t2 ++; for (i = 0; - (i < nargs) && TYPE_CODE (t1[i].type) != TYPE_CODE_VOID; + (i < nargs) && t1[i].type->code () != TYPE_CODE_VOID; i++) { struct type *tt1, *tt2; @@ -1720,13 +1720,13 @@ typecmp (int staticp, int varargs, int nargs, if (TYPE_IS_REFERENCE (tt1) /* We should be doing hairy argument matching, as below. */ - && (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (tt1))) - == TYPE_CODE (tt2))) + && (check_typedef (TYPE_TARGET_TYPE (tt1))->code () + == tt2->code ())) { - if (TYPE_CODE (tt2) == TYPE_CODE_ARRAY) + if (tt2->code () == TYPE_CODE_ARRAY) t2[i] = value_coerce_array (t2[i]); else - t2[i] = value_ref (t2[i], TYPE_CODE (tt1)); + t2[i] = value_ref (t2[i], tt1->code ()); continue; } @@ -1736,17 +1736,17 @@ typecmp (int staticp, int varargs, int nargs, char *>, and properly access map["hello"], because the argument to [] will be a reference to a pointer to a char, and the argument will be a pointer to a char. */ - while (TYPE_IS_REFERENCE (tt1) || TYPE_CODE (tt1) == TYPE_CODE_PTR) + while (TYPE_IS_REFERENCE (tt1) || tt1->code () == TYPE_CODE_PTR) { - tt1 = check_typedef( TYPE_TARGET_TYPE(tt1) ); + tt1 = check_typedef ( TYPE_TARGET_TYPE (tt1) ); } - while (TYPE_CODE(tt2) == TYPE_CODE_ARRAY - || TYPE_CODE(tt2) == TYPE_CODE_PTR + while (tt2->code () == TYPE_CODE_ARRAY + || tt2->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (tt2)) { - tt2 = check_typedef (TYPE_TARGET_TYPE(tt2)); + tt2 = check_typedef (TYPE_TARGET_TYPE (tt2)); } - if (TYPE_CODE (tt1) == TYPE_CODE (tt2)) + if (tt1->code () == tt2->code ()) continue; /* Array to pointer is a `trivial conversion' according to the ARM. */ @@ -1754,7 +1754,7 @@ typecmp (int staticp, int varargs, int nargs, /* We should be doing much hairier argument matching (see section 13.2 of the ARM), but as a quick kludge, just check for the same type code. */ - if (TYPE_CODE (t1[i].type) != TYPE_CODE (value_type (t2[i]))) + if (t1[i].type->code () != value_type (t2[i])->code ()) return i + 1; } if (varargs || t2[i] == NULL) @@ -1826,8 +1826,8 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset, { struct type *field_type = TYPE_FIELD_TYPE (type, i); - if (TYPE_CODE (field_type) == TYPE_CODE_UNION - || TYPE_CODE (field_type) == TYPE_CODE_STRUCT) + if (field_type->code () == TYPE_CODE_UNION + || field_type->code () == TYPE_CODE_STRUCT) { /* Look for a match through the fields of an anonymous union, or anonymous struct. C++ provides anonymous @@ -1850,7 +1850,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset, from GDB) implementation of variant records, the bitpos is zero in an anonymous union field, so we have to add the offset of the union here. */ - if (TYPE_CODE (field_type) == TYPE_CODE_STRUCT + if (field_type->code () == TYPE_CODE_STRUCT || (TYPE_NFIELDS (field_type) > 0 && TYPE_FIELD_BITPOS (field_type, 0) == 0)) new_offset += TYPE_FIELD_BITPOS (type, i) / 8; @@ -2119,17 +2119,17 @@ value_struct_elt (struct value **argp, struct value **args, /* Follow pointers until we get to a non-pointer. */ - while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ - if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC) + if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC) *argp = coerce_array (*argp); t = check_typedef (value_type (*argp)); } - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION) error (_("Attempt to extract a component of a value that is not a %s."), err); @@ -2206,16 +2206,16 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype, t = check_typedef (value_type (*argp)); - while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) { *argp = value_ind (*argp); - if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC) + if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC) *argp = coerce_array (*argp); t = check_typedef (value_type (*argp)); } - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION) error (_("Attempt to extract a component of a value that is not a %s."), err); @@ -2359,17 +2359,17 @@ value_find_oload_method_list (struct value **argp, const char *method, t = check_typedef (value_type (*argp)); /* Code snarfed from value_struct_elt. */ - while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ - if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC) + if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC) *argp = coerce_array (*argp); t = check_typedef (value_type (*argp)); } - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION) error (_("Attempt to extract a component of a " "value that is not a struct or union")); @@ -2477,13 +2477,13 @@ find_overload_match (gdb::array_view<value *> args, /* OBJ may be a pointer value rather than the object itself. */ obj = coerce_ref (obj); - while (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_PTR) + while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR) obj = coerce_ref (value_ind (obj)); obj_type_name = TYPE_NAME (value_type (obj)); /* First check whether this is a data member, e.g. a pointer to a function. */ - if (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_STRUCT) + if (check_typedef (value_type (obj))->code () == TYPE_CODE_STRUCT) { *valp = search_struct_field (name, obj, check_typedef (value_type (obj)), 0); @@ -2606,8 +2606,8 @@ find_overload_match (gdb::array_view<value *> args, the function part. Do not try this for non-functions (e.g. function pointers). */ if (qualified_name - && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) - == TYPE_CODE_FUNC) + && (check_typedef (SYMBOL_TYPE (fsym))->code () + == TYPE_CODE_FUNC)) { temp_func = cp_func_name (qualified_name); @@ -2752,8 +2752,8 @@ find_overload_match (gdb::array_view<value *> args, struct type *temp_type = check_typedef (value_type (temp)); struct type *objtype = check_typedef (obj_type); - if (TYPE_CODE (temp_type) != TYPE_CODE_PTR - && (TYPE_CODE (objtype) == TYPE_CODE_PTR + if (temp_type->code () != TYPE_CODE_PTR + && (objtype->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (objtype))) { temp = value_addr (temp); @@ -3118,7 +3118,7 @@ enum_constant_from_type (struct type *type, const char *name) int i; int name_len = strlen (name); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_ENUM + gdb_assert (type->code () == TYPE_CODE_ENUM && TYPE_DECLARED_CLASS (type)); for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); ++i) @@ -3155,7 +3155,7 @@ value_aggregate_elt (struct type *curtype, const char *name, struct type *expect_type, int want_address, enum noside noside) { - switch (TYPE_CODE (curtype)) + switch (curtype->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -3206,7 +3206,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial) /* Special case: a method taking void. T1 will contain no non-artificial fields, and T2 will contain TYPE_CODE_VOID. */ if ((TYPE_NFIELDS (t1) - start) == 0 && TYPE_NFIELDS (t2) == 1 - && TYPE_CODE (TYPE_FIELD_TYPE (t2, 0)) == TYPE_CODE_VOID) + && TYPE_FIELD_TYPE (t2, 0)->code () == TYPE_CODE_VOID) return 1; if ((TYPE_NFIELDS (t1) - start) == TYPE_NFIELDS (t2)) @@ -3288,8 +3288,8 @@ value_struct_elt_for_reference (struct type *domain, int offset, int i; struct value *result; - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) + if (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION) error (_("Internal error: non-aggregate type " "to value_struct_elt_for_reference")); @@ -3330,7 +3330,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, ptr = value_aggregate_elt (domain, name, NULL, 1, noside); type = check_typedef (value_type (ptr)); gdb_assert (type != NULL - && TYPE_CODE (type) == TYPE_CODE_MEMBERPTR); + && type->code () == TYPE_CODE_MEMBERPTR); tmp = lookup_pointer_type (TYPE_SELF_TYPE (type)); v = value_cast_pointers (tmp, v, 1); mem_offset = value_as_long (ptr); @@ -3367,7 +3367,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, as a pointer to a method. */ /* Perform all necessary dereferencing. */ - while (intype && TYPE_CODE (intype) == TYPE_CODE_PTR) + while (intype && intype->code () == TYPE_CODE_PTR) intype = TYPE_TARGET_TYPE (intype); for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i) @@ -3581,7 +3581,7 @@ value_rtti_indirect_type (struct value *v, int *full, type = check_typedef (type); if (TYPE_IS_REFERENCE (type)) target = coerce_ref (v); - else if (TYPE_CODE (type) == TYPE_CODE_PTR) + else if (type->code () == TYPE_CODE_PTR) { try @@ -3612,8 +3612,8 @@ value_rtti_indirect_type (struct value *v, int *full, real_type = make_cv_type (TYPE_CONST (target_type), TYPE_VOLATILE (target_type), real_type, NULL); if (TYPE_IS_REFERENCE (type)) - real_type = lookup_reference_type (real_type, TYPE_CODE (type)); - else if (TYPE_CODE (type) == TYPE_CODE_PTR) + real_type = lookup_reference_type (real_type, type->code ()); + else if (type->code () == TYPE_CODE_PTR) real_type = lookup_pointer_type (real_type); else internal_error (__FILE__, __LINE__, _("Unexpected value type.")); @@ -3760,8 +3760,8 @@ value_slice (struct value *array, int lowbound, int length) struct type *array_type; array_type = check_typedef (value_type (array)); - if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY - && TYPE_CODE (array_type) != TYPE_CODE_STRING) + if (array_type->code () != TYPE_CODE_ARRAY + && array_type->code () != TYPE_CODE_STRING) error (_("cannot take slice of non-array")); if (type_not_allocated (array_type)) @@ -3792,7 +3792,7 @@ value_slice (struct value *array, int lowbound, int length) slice_type = create_array_type (NULL, element_type, slice_range_type); - slice_type->set_code (TYPE_CODE (array_type)); + slice_type->set_code (array_type->code ()); if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) slice = allocate_value_lazy (slice_type); @@ -3839,7 +3839,7 @@ value_real_part (struct value *value) struct type *type = check_typedef (value_type (value)); struct type *ttype = TYPE_TARGET_TYPE (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_COMPLEX); + gdb_assert (type->code () == TYPE_CODE_COMPLEX); return value_from_component (value, ttype, 0); } @@ -3851,7 +3851,7 @@ value_imaginary_part (struct value *value) struct type *type = check_typedef (value_type (value)); struct type *ttype = TYPE_TARGET_TYPE (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_COMPLEX); + gdb_assert (type->code () == TYPE_CODE_COMPLEX); return value_from_component (value, ttype, TYPE_LENGTH (check_typedef (ttype))); } @@ -3863,7 +3863,7 @@ cast_into_complex (struct type *type, struct value *val) { struct type *real_type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (value_type (val)) == TYPE_CODE_COMPLEX) + if (value_type (val)->code () == TYPE_CODE_COMPLEX) { struct type *val_real_type = TYPE_TARGET_TYPE (value_type (val)); struct value *re_val = allocate_value (val_real_type); @@ -3877,8 +3877,8 @@ cast_into_complex (struct type *type, struct value *val) return value_literal_complex (re_val, im_val, type); } - else if (TYPE_CODE (value_type (val)) == TYPE_CODE_FLT - || TYPE_CODE (value_type (val)) == TYPE_CODE_INT) + else if (value_type (val)->code () == TYPE_CODE_FLT + || value_type (val)->code () == TYPE_CODE_INT) return value_literal_complex (val, value_zero (real_type, not_lval), type); diff --git a/gdb/valprint.c b/gdb/valprint.c index 2f91024..4bd643e 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -276,7 +276,7 @@ val_print_scalar_type_p (struct type *type) type = TYPE_TARGET_TYPE (type); type = check_typedef (type); } - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: case TYPE_CODE_STRUCT: @@ -323,9 +323,9 @@ valprint_check_validity (struct ui_file *stream, return 0; } - if (TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_ARRAY) + if (type->code () != TYPE_CODE_UNION + && type->code () != TYPE_CODE_STRUCT + && type->code () != TYPE_CODE_ARRAY) { if (value_bits_any_optimized_out (val, TARGET_CHAR_BIT * embedded_offset, @@ -338,7 +338,7 @@ valprint_check_validity (struct ui_file *stream, if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * embedded_offset, TARGET_CHAR_BIT * TYPE_LENGTH (type))) { - const int is_ref = TYPE_CODE (type) == TYPE_CODE_REF; + const int is_ref = type->code () == TYPE_CODE_REF; int ref_is_addressable = 0; if (is_ref) @@ -408,7 +408,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype, { struct gdbarch *gdbarch = get_type_arch (type); - if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) + if (elttype->code () == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ print_function_pointer_address (options, gdbarch, address, stream); @@ -527,7 +527,7 @@ generic_val_print_ref (struct type *type, TARGET_CHAR_BIT * TYPE_LENGTH (type)); const int must_coerce_ref = ((options->addressprint && value_is_synthetic) || options->deref_ref); - const int type_is_defined = TYPE_CODE (elttype) != TYPE_CODE_UNDEF; + const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF; const gdb_byte *valaddr = value_contents_for_printing (original_value); if (must_coerce_ref && type_is_defined) @@ -825,7 +825,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, struct type *type = value_type (val); type = check_typedef (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: generic_val_print_array (val, stream, recurse, options, decorations); @@ -924,7 +924,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, case TYPE_CODE_METHODPTR: default: error (_("Unhandled type code %d in symbol table."), - TYPE_CODE (type)); + type->code ()); } } @@ -1043,7 +1043,7 @@ value_check_printable (struct value *val, struct ui_file *stream, return 0; } - if (TYPE_CODE (value_type (val)) == TYPE_CODE_INTERNAL_FUNCTION) + if (value_type (val)->code () == TYPE_CODE_INTERNAL_FUNCTION) { fprintf_styled (stream, metadata_style.style (), _("<internal function %s>"), @@ -1170,7 +1170,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value, fprintf_filtered (stream, " %ps=", styled_string (variable_name_style.style (), TYPE_FIELD_NAME (type, field))); - if (TYPE_CODE (field_type) == TYPE_CODE_ENUM) + if (field_type->code () == TYPE_CODE_ENUM) generic_val_print_enum_1 (field_type, field_val, stream); else print_longest (stream, 'd', 0, field_val); @@ -1889,7 +1889,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream, if (get_array_bounds (type, &low_bound, &high_bound)) { - if (TYPE_CODE (index_type) == TYPE_CODE_RANGE) + if (index_type->code () == TYPE_CODE_RANGE) base_index_type = TYPE_TARGET_TYPE (index_type); else base_index_type = index_type; diff --git a/gdb/value.c b/gdb/value.c index aafbf0f..df14232 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1177,9 +1177,9 @@ value_actual_type (struct value *value, int resolve_simple_types, { /* If result's target type is TYPE_CODE_STRUCT, proceed to fetch its rtti type. */ - if ((TYPE_CODE (result) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result)) - && TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (result))) - == TYPE_CODE_STRUCT + if ((result->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result)) + && (check_typedef (TYPE_TARGET_TYPE (result))->code () + == TYPE_CODE_STRUCT) && !value_optimized_out (value)) { struct type *real_type; @@ -2189,7 +2189,7 @@ get_internalvar_integer (struct internalvar *var, LONGEST *result) { struct type *type = check_typedef (value_type (var->u.value)); - if (TYPE_CODE (type) == TYPE_CODE_INT) + if (type->code () == TYPE_CODE_INT) { *result = value_as_long (var->u.value); return 1; @@ -2254,7 +2254,7 @@ set_internalvar (struct internalvar *var, struct value *val) error (_("Cannot overwrite convenience function %s"), var->name); /* Prepare new contents. */ - switch (TYPE_CODE (check_typedef (value_type (val)))) + switch (check_typedef (value_type (val))->code ()) { case TYPE_CODE_VOID: new_kind = INTERNALVAR_VOID; @@ -2591,7 +2591,7 @@ value_from_xmethod (xmethod_worker_up &&worker) struct type * result_type_of_xmethod (struct value *method, gdb::array_view<value *> argv) { - gdb_assert (TYPE_CODE (value_type (method)) == TYPE_CODE_XMETHOD + gdb_assert (value_type (method)->code () == TYPE_CODE_XMETHOD && method->lval == lval_xcallable && !argv.empty ()); return method->location.xm_worker->get_result_type (argv[0], argv.slice (1)); @@ -2602,7 +2602,7 @@ result_type_of_xmethod (struct value *method, gdb::array_view<value *> argv) struct value * call_xmethod (struct value *method, gdb::array_view<value *> argv) { - gdb_assert (TYPE_CODE (value_type (method)) == TYPE_CODE_XMETHOD + gdb_assert (value_type (method)->code () == TYPE_CODE_XMETHOD && method->lval == lval_xcallable && !argv.empty ()); return method->location.xm_worker->invoke (argv[0], argv.slice (1)); @@ -2677,8 +2677,8 @@ value_as_address (struct value *val) The following shortcut avoids this whole mess. If VAL is a function, just return its address directly. */ - if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC - || TYPE_CODE (value_type (val)) == TYPE_CODE_METHOD) + if (value_type (val)->code () == TYPE_CODE_FUNC + || value_type (val)->code () == TYPE_CODE_METHOD) return value_address (val); val = coerce_array (val); @@ -2720,7 +2720,7 @@ value_as_address (struct value *val) converted to pointers; usually, the ABI doesn't either, but ABI-specific code is a more reasonable place to handle it. */ - if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR + if (value_type (val)->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (value_type (val)) && gdbarch_integer_to_address_p (gdbarch)) return gdbarch_integer_to_address (gdbarch, value_type (val), @@ -2748,7 +2748,7 @@ LONGEST unpack_long (struct type *type, const gdb_byte *valaddr) { enum bfd_endian byte_order = type_byte_order (type); - enum type_code code = TYPE_CODE (type); + enum type_code code = type->code (); int len = TYPE_LENGTH (type); int nosign = TYPE_UNSIGNED (type); @@ -3317,7 +3317,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) type = check_typedef (type); len = TYPE_LENGTH (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_RANGE: num -= TYPE_RANGE_DATA (type)->bias; @@ -3344,7 +3344,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) default: error (_("Unexpected type (%d) encountered for integer constant."), - TYPE_CODE (type)); + type->code ()); } } @@ -3361,7 +3361,7 @@ pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num) len = TYPE_LENGTH (type); byte_order = type_byte_order (type); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_CHAR: @@ -3387,7 +3387,7 @@ pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num) default: error (_("Unexpected type (%d) encountered " "for unsigned integer constant."), - TYPE_CODE (type)); + type->code ()); } } @@ -3438,7 +3438,7 @@ struct value * value_from_host_double (struct type *type, double d) { struct value *value = allocate_value (type); - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + gdb_assert (type->code () == TYPE_CODE_FLT); target_float_from_host_double (value_contents_raw (value), value_type (value), d); return value; @@ -3664,7 +3664,7 @@ coerce_array (struct value *arg) arg = coerce_ref (arg); type = check_typedef (value_type (arg)); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_ARRAY: if (!TYPE_VECTOR (type) && current_language->c_style_arrays) @@ -3685,7 +3685,7 @@ enum return_value_convention struct_return_convention (struct gdbarch *gdbarch, struct value *function, struct type *value_type) { - enum type_code code = TYPE_CODE (value_type); + enum type_code code = value_type->code (); if (code == TYPE_CODE_ERROR) error (_("Function return type unknown.")); @@ -3703,7 +3703,7 @@ int using_struct_return (struct gdbarch *gdbarch, struct value *function, struct type *value_type) { - if (TYPE_CODE (value_type) == TYPE_CODE_VOID) + if (value_type->code () == TYPE_CODE_VOID) /* A void return value is never in memory. See also corresponding code in "print_return_value". */ return 0; @@ -3931,7 +3931,7 @@ isvoid_internal_fn (struct gdbarch *gdbarch, if (argc != 1) error (_("You must provide one argument for $_isvoid.")); - ret = TYPE_CODE (value_type (argv[0])) == TYPE_CODE_VOID; + ret = value_type (argv[0])->code () == TYPE_CODE_VOID; return value_from_longest (builtin_type (gdbarch)->builtin_int, ret); } @@ -3949,7 +3949,7 @@ creal_internal_fn (struct gdbarch *gdbarch, value *cval = argv[0]; type *ctype = check_typedef (value_type (cval)); - if (TYPE_CODE (ctype) != TYPE_CODE_COMPLEX) + if (ctype->code () != TYPE_CODE_COMPLEX) error (_("expected a complex number")); return value_real_part (cval); } @@ -3968,7 +3968,7 @@ cimag_internal_fn (struct gdbarch *gdbarch, value *cval = argv[0]; type *ctype = check_typedef (value_type (cval)); - if (TYPE_CODE (ctype) != TYPE_CODE_COMPLEX) + if (ctype->code () != TYPE_CODE_COMPLEX) error (_("expected a complex number")); return value_imaginary_part (cval); } diff --git a/gdb/varobj.c b/gdb/varobj.c index 8a7b710..3358be4 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1271,7 +1271,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial) if (value) value = coerce_ref (value); - if (var->type && TYPE_CODE (var->type) == TYPE_CODE_UNION) + if (var->type && var->type->code () == TYPE_CODE_UNION) /* For unions, we need to fetch the value implicitly because of implementation of union member fetch. When gdb creates a value for a field and the value of the enclosing @@ -2398,7 +2398,7 @@ varobj_editable_p (const struct varobj *var) type = varobj_get_value_type (var); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -2445,7 +2445,7 @@ varobj_default_value_is_changeable_p (const struct varobj *var) type = varobj_get_value_type (var); - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 9373dc8..1e60fba 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -206,9 +206,9 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function, int len = TYPE_LENGTH (type); gdb_byte buf[8]; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION - || TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_STRUCT + || type->code () == TYPE_CODE_UNION + || type->code () == TYPE_CODE_ARRAY) { /* The default on VAX is to return structures in static memory. Consequently a function must return the address where we can diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 1715dc8..9818d97 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -133,9 +133,9 @@ xstormy16_register_type (struct gdbarch *gdbarch, int regnum) static int xstormy16_type_is_scalar (struct type *t) { - return (TYPE_CODE(t) != TYPE_CODE_STRUCT - && TYPE_CODE(t) != TYPE_CODE_UNION - && TYPE_CODE(t) != TYPE_CODE_ARRAY); + return (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION + && t->code () != TYPE_CODE_ARRAY); } /* Function: xstormy16_use_struct_convention @@ -610,7 +610,7 @@ xstormy16_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); + enum type_code target = TYPE_TARGET_TYPE (type)->code (); CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); @@ -629,7 +629,7 @@ xstormy16_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); + enum type_code target = TYPE_TARGET_TYPE (type)->code (); if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD) { diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 2ea1121..97486de 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -1651,9 +1651,9 @@ xtensa_return_value (struct gdbarch *gdbarch, { /* Structures up to 16 bytes are returned in registers. */ - int struct_return = ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + int struct_return = ((valtype->code () == TYPE_CODE_STRUCT + || valtype->code () == TYPE_CODE_UNION + || valtype->code () == TYPE_CODE_ARRAY) && TYPE_LENGTH (valtype) > 16); if (struct_return) @@ -1726,7 +1726,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "%2d: %s %3s ", i, host_address_to_string (arg), pulongest (TYPE_LENGTH (arg_type))); - switch (TYPE_CODE (arg_type)) + switch (arg_type->code ()) { case TYPE_CODE_INT: fprintf_unfiltered (gdb_stdlog, "int"); @@ -1735,7 +1735,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "struct"); break; default: - fprintf_unfiltered (gdb_stdlog, "%3d", TYPE_CODE (arg_type)); + fprintf_unfiltered (gdb_stdlog, "%3d", arg_type->code ()); break; } fprintf_unfiltered (gdb_stdlog, " %s\n", @@ -1760,7 +1760,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, struct value *arg = args[i]; struct type *arg_type = check_typedef (value_type (arg)); - switch (TYPE_CODE (arg_type)) + switch (arg_type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: |