mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
gdbtypes.h: Get rid of the TYPE_FIXED_POINT_INFO macro
This is one step further towards the removal of all these macros. gdb/ChangeLog: * gdbtypes.h (struct type) <fixed_point_info, set_fixed_point_info>: New methods. (INIT_FIXED_POINT_SPECIFIC): Adjust. (TYPE_FIXED_POINT_INFO): Delete macro. (allocate_fixed_point_type_info): Change return type to void. * gdbtypes.c (copy_type_recursive): Replace the use of TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method. (fixed_point_scaling_factor): Likewise. (allocate_fixed_point_type_info): Change return type to void. Adjust implementation accordingly. * dwarf2/read.c (finish_fixed_point_type): Replace the use of TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
This commit is contained in:
@ -1,3 +1,18 @@
|
|||||||
|
2020-11-24 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
* gdbtypes.h (struct type) <fixed_point_info, set_fixed_point_info>:
|
||||||
|
New methods.
|
||||||
|
(INIT_FIXED_POINT_SPECIFIC): Adjust.
|
||||||
|
(TYPE_FIXED_POINT_INFO): Delete macro.
|
||||||
|
(allocate_fixed_point_type_info): Change return type to void.
|
||||||
|
* gdbtypes.c (copy_type_recursive): Replace the use of
|
||||||
|
TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
|
||||||
|
(fixed_point_scaling_factor): Likewise.
|
||||||
|
(allocate_fixed_point_type_info): Change return type to void.
|
||||||
|
Adjust implementation accordingly.
|
||||||
|
* dwarf2/read.c (finish_fixed_point_type): Replace the use of
|
||||||
|
TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
|
||||||
|
|
||||||
2020-11-24 Joel Brobecker <brobecker@adacore.com>
|
2020-11-24 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* gmp-utils.h (gdb_mpz::read): Change buf and len parameters
|
* gmp-utils.h (gdb_mpz::read): Change buf and len parameters
|
||||||
|
@ -18162,7 +18162,7 @@ get_dwarf2_unsigned_rational_constant (struct die_info *die,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming DIE corresponds to a fixed point type, finish the creation
|
/* Assuming DIE corresponds to a fixed point type, finish the creation
|
||||||
of the corresponding TYPE by setting its TYPE_FIXED_POINT_INFO.
|
of the corresponding TYPE by setting its type-specific data.
|
||||||
CU is the DIE's CU. */
|
CU is the DIE's CU. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -18232,7 +18232,7 @@ finish_fixed_point_type (struct type *type, struct die_info *die,
|
|||||||
sect_offset_str (die->sect_off));
|
sect_offset_str (die->sect_off));
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_mpq &scaling_factor = TYPE_FIXED_POINT_INFO (type)->scaling_factor;
|
gdb_mpq &scaling_factor = type->fixed_point_info ().scaling_factor;
|
||||||
|
|
||||||
gdb_mpz tmp_z (scale_num);
|
gdb_mpz tmp_z (scale_num);
|
||||||
mpz_set (mpq_numref (scaling_factor.val), tmp_z.val);
|
mpz_set (mpq_numref (scaling_factor.val), tmp_z.val);
|
||||||
|
@ -5503,8 +5503,8 @@ copy_type_recursive (struct objfile *objfile,
|
|||||||
break;
|
break;
|
||||||
case TYPE_SPECIFIC_FIXED_POINT:
|
case TYPE_SPECIFIC_FIXED_POINT:
|
||||||
INIT_FIXED_POINT_SPECIFIC (new_type);
|
INIT_FIXED_POINT_SPECIFIC (new_type);
|
||||||
TYPE_FIXED_POINT_INFO (new_type)->scaling_factor
|
new_type->fixed_point_info ().scaling_factor
|
||||||
= TYPE_FIXED_POINT_INFO (type)->scaling_factor;
|
= type->fixed_point_info ().scaling_factor;
|
||||||
break;
|
break;
|
||||||
case TYPE_SPECIFIC_INT:
|
case TYPE_SPECIFIC_INT:
|
||||||
TYPE_SPECIFIC_FIELD (new_type) = TYPE_SPECIFIC_INT;
|
TYPE_SPECIFIC_FIELD (new_type) = TYPE_SPECIFIC_INT;
|
||||||
@ -5826,11 +5826,11 @@ static const struct objfile_key<fixed_point_type_storage>
|
|||||||
|
|
||||||
/* See gdbtypes.h. */
|
/* See gdbtypes.h. */
|
||||||
|
|
||||||
fixed_point_type_info *
|
void
|
||||||
allocate_fixed_point_type_info (struct type *type)
|
allocate_fixed_point_type_info (struct type *type)
|
||||||
{
|
{
|
||||||
std::unique_ptr<fixed_point_type_info> up (new fixed_point_type_info);
|
std::unique_ptr<fixed_point_type_info> up (new fixed_point_type_info);
|
||||||
fixed_point_type_info *result;
|
fixed_point_type_info *info;
|
||||||
|
|
||||||
if (TYPE_OBJFILE_OWNED (type))
|
if (TYPE_OBJFILE_OWNED (type))
|
||||||
{
|
{
|
||||||
@ -5838,17 +5838,17 @@ allocate_fixed_point_type_info (struct type *type)
|
|||||||
= fixed_point_objfile_key.get (TYPE_OBJFILE (type));
|
= fixed_point_objfile_key.get (TYPE_OBJFILE (type));
|
||||||
if (storage == nullptr)
|
if (storage == nullptr)
|
||||||
storage = fixed_point_objfile_key.emplace (TYPE_OBJFILE (type));
|
storage = fixed_point_objfile_key.emplace (TYPE_OBJFILE (type));
|
||||||
result = up.get ();
|
info = up.get ();
|
||||||
storage->push_back (std::move (up));
|
storage->push_back (std::move (up));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We just leak the memory, because that's what we do generally
|
/* We just leak the memory, because that's what we do generally
|
||||||
for non-objfile-attached types. */
|
for non-objfile-attached types. */
|
||||||
result = up.release ();
|
info = up.release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
type->set_fixed_point_info (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See gdbtypes.h. */
|
/* See gdbtypes.h. */
|
||||||
@ -5883,7 +5883,7 @@ fixed_point_scaling_factor (struct type *type)
|
|||||||
{
|
{
|
||||||
type = fixed_point_type_base_type (type);
|
type = fixed_point_type_base_type (type);
|
||||||
|
|
||||||
return TYPE_FIXED_POINT_INFO (type)->scaling_factor;
|
return type->fixed_point_info ().scaling_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1194,6 +1194,27 @@ struct type
|
|||||||
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
|
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
|
||||||
|
to this type's fixed_point_info. */
|
||||||
|
|
||||||
|
struct fixed_point_type_info &fixed_point_info () const
|
||||||
|
{
|
||||||
|
gdb_assert (this->code () == TYPE_CODE_FIXED_POINT);
|
||||||
|
gdb_assert (this->main_type->type_specific.fixed_point_info != nullptr);
|
||||||
|
|
||||||
|
return *this->main_type->type_specific.fixed_point_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's
|
||||||
|
fixed_point_info to INFO. */
|
||||||
|
|
||||||
|
void set_fixed_point_info (struct fixed_point_type_info *info) const
|
||||||
|
{
|
||||||
|
gdb_assert (this->code () == TYPE_CODE_FIXED_POINT);
|
||||||
|
|
||||||
|
this->main_type->type_specific.fixed_point_info = info;
|
||||||
|
}
|
||||||
|
|
||||||
/* * Return the dynamic property of the requested KIND from this type's
|
/* * Return the dynamic property of the requested KIND from this type's
|
||||||
list of dynamic properties. */
|
list of dynamic properties. */
|
||||||
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
|
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
|
||||||
@ -1747,7 +1768,7 @@ extern void allocate_gnat_aux_type (struct type *);
|
|||||||
handled. */
|
handled. */
|
||||||
#define INIT_FIXED_POINT_SPECIFIC(type) \
|
#define INIT_FIXED_POINT_SPECIFIC(type) \
|
||||||
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
|
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
|
||||||
TYPE_FIXED_POINT_INFO (type) = allocate_fixed_point_type_info (type))
|
allocate_fixed_point_type_info (type))
|
||||||
|
|
||||||
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
|
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
|
||||||
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
|
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
|
||||||
@ -1845,9 +1866,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
|||||||
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
||||||
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
|
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
|
||||||
|
|
||||||
#define TYPE_FIXED_POINT_INFO(thistype) \
|
|
||||||
(TYPE_MAIN_TYPE(thistype)->type_specific.fixed_point_info)
|
|
||||||
|
|
||||||
#define FIELD_NAME(thisfld) ((thisfld).name)
|
#define FIELD_NAME(thisfld) ((thisfld).name)
|
||||||
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
||||||
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
|
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
|
||||||
@ -2582,8 +2600,7 @@ extern const gdb_mpq &fixed_point_scaling_factor (struct type *type);
|
|||||||
|
|
||||||
/* Allocate a fixed-point type info for TYPE. This should only be
|
/* Allocate a fixed-point type info for TYPE. This should only be
|
||||||
called by INIT_FIXED_POINT_SPECIFIC. */
|
called by INIT_FIXED_POINT_SPECIFIC. */
|
||||||
extern fixed_point_type_info *allocate_fixed_point_type_info
|
extern void allocate_fixed_point_type_info (struct type *type);
|
||||||
(struct type *type);
|
|
||||||
|
|
||||||
/* * When the type includes explicit byte ordering, return that.
|
/* * When the type includes explicit byte ordering, return that.
|
||||||
Otherwise, the byte ordering from gdbarch_byte_order for
|
Otherwise, the byte ordering from gdbarch_byte_order for
|
||||||
|
Reference in New Issue
Block a user