forked from Imagelibrary/binutils-gdb
gdb: remove TYPE_FIELD_PACKED
Replace with a new equivalent "is_packed" method on struct field. Change-Id: I78647be3d408b40b63becb6b6f0fca211bede51c Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
committed by
Simon Marchi
parent
3757d2d44f
commit
8c329d5c65
@@ -615,7 +615,7 @@ print_field_values (struct value *value, struct value *outer_value,
|
|||||||
gdb_puts (" => ", stream);
|
gdb_puts (" => ", stream);
|
||||||
annotate_field_value ();
|
annotate_field_value ();
|
||||||
|
|
||||||
if (TYPE_FIELD_PACKED (type, i))
|
if (type->field (i).is_packed ())
|
||||||
{
|
{
|
||||||
/* Bitfields require special handling, especially due to byte
|
/* Bitfields require special handling, especially due to byte
|
||||||
order problems. */
|
order problems. */
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ amd64_has_unaligned_fields (struct type *type)
|
|||||||
if (type->field (i).is_static ()
|
if (type->field (i).is_static ()
|
||||||
|| (type->field (i).bitsize () == 0
|
|| (type->field (i).bitsize () == 0
|
||||||
&& subtype->length () == 0)
|
&& subtype->length () == 0)
|
||||||
|| TYPE_FIELD_PACKED (type, i))
|
|| type->field (i).is_packed ())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int bitpos = type->field (i).loc_bitpos ();
|
int bitpos = type->field (i).loc_bitpos ();
|
||||||
|
|||||||
@@ -1317,7 +1317,7 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
|
|||||||
int offset, int fieldno, struct type *type)
|
int offset, int fieldno, struct type *type)
|
||||||
{
|
{
|
||||||
/* Is this a bitfield? */
|
/* Is this a bitfield? */
|
||||||
if (TYPE_FIELD_PACKED (type, fieldno))
|
if (type->field (fieldno).is_packed ())
|
||||||
gen_bitfield_ref (ax, value, type->field (fieldno).type (),
|
gen_bitfield_ref (ax, value, type->field (fieldno).type (),
|
||||||
(offset * TARGET_CHAR_BIT
|
(offset * TARGET_CHAR_BIT
|
||||||
+ type->field (fieldno).loc_bitpos ()),
|
+ type->field (fieldno).loc_bitpos ()),
|
||||||
@@ -1502,7 +1502,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
|
|||||||
fieldname);
|
fieldname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (TYPE_FIELD_PACKED (t, i))
|
if (t->field (i).is_packed ())
|
||||||
error (_("pointers to bitfield members not allowed"));
|
error (_("pointers to bitfield members not allowed"));
|
||||||
|
|
||||||
/* FIXME we need a way to do "want_address" equivalent */
|
/* FIXME we need a way to do "want_address" equivalent */
|
||||||
|
|||||||
@@ -1154,7 +1154,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
|
|||||||
stream, newshow, level + 4,
|
stream, newshow, level + 4,
|
||||||
language, &local_flags, &local_podata);
|
language, &local_flags, &local_podata);
|
||||||
|
|
||||||
if (!is_static && TYPE_FIELD_PACKED (type, i))
|
if (!is_static && type->field (i).is_packed ())
|
||||||
{
|
{
|
||||||
/* It is a bitfield. This code does not attempt
|
/* It is a bitfield. This code does not attempt
|
||||||
to look at the bitpos and reconstruct filler,
|
to look at the bitpos and reconstruct filler,
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
|
|||||||
annotate_field_value ();
|
annotate_field_value ();
|
||||||
|
|
||||||
if (!type->field (i).is_static ()
|
if (!type->field (i).is_static ()
|
||||||
&& TYPE_FIELD_PACKED (type, i))
|
&& type->field (i).is_packed ())
|
||||||
{
|
{
|
||||||
struct value *v;
|
struct value *v;
|
||||||
|
|
||||||
|
|||||||
@@ -584,6 +584,11 @@ struct field
|
|||||||
m_bitsize = bitsize;
|
m_bitsize = bitsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_packed () const
|
||||||
|
{
|
||||||
|
return m_bitsize != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return true if this field is static; false if not. */
|
/* Return true if this field is static; false if not. */
|
||||||
bool is_static () const
|
bool is_static () const
|
||||||
{
|
{
|
||||||
@@ -1933,8 +1938,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_FIELD_PACKED(thistype, n) (((thistype)->field (n).bitsize ())!=0)
|
|
||||||
|
|
||||||
#define TYPE_FIELD_PRIVATE_BITS(thistype) \
|
#define TYPE_FIELD_PRIVATE_BITS(thistype) \
|
||||||
TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
|
TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
|
||||||
#define TYPE_FIELD_PROTECTED_BITS(thistype) \
|
#define TYPE_FIELD_PROTECTED_BITS(thistype) \
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
|
|||||||
m2_print_type (type->field (i).type (),
|
m2_print_type (type->field (i).type (),
|
||||||
"",
|
"",
|
||||||
stream, 0, level + 4, flags);
|
stream, 0, level + 4, flags);
|
||||||
if (TYPE_FIELD_PACKED (type, i))
|
if (type->field (i).is_packed ())
|
||||||
{
|
{
|
||||||
/* It is a bitfield. This code does not attempt
|
/* It is a bitfield. This code does not attempt
|
||||||
to look at the bitpos and reconstruct filler,
|
to look at the bitpos and reconstruct filler,
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||||||
type->field (i).name (),
|
type->field (i).name (),
|
||||||
stream, show - 1, level + 4, flags);
|
stream, show - 1, level + 4, flags);
|
||||||
if (!type->field (i).is_static ()
|
if (!type->field (i).is_static ()
|
||||||
&& TYPE_FIELD_PACKED (type, i))
|
&& type->field (i).is_packed ())
|
||||||
{
|
{
|
||||||
/* It is a bitfield. This code does not attempt
|
/* It is a bitfield. This code does not attempt
|
||||||
to look at the bitpos and reconstruct filler,
|
to look at the bitpos and reconstruct filler,
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
|
|||||||
annotate_field_value ();
|
annotate_field_value ();
|
||||||
|
|
||||||
if (!type->field (i).is_static ()
|
if (!type->field (i).is_static ()
|
||||||
&& TYPE_FIELD_PACKED (type, i))
|
&& type->field (i).is_packed ())
|
||||||
{
|
{
|
||||||
struct value *v;
|
struct value *v;
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
|
|||||||
|
|
||||||
maybe_print_hole (stream, bitpos, "hole");
|
maybe_print_hole (stream, bitpos, "hole");
|
||||||
|
|
||||||
if (TYPE_FIELD_PACKED (type, field_idx)
|
if (type->field (field_idx).is_packed ()
|
||||||
|| offset_bitpos % TARGET_CHAR_BIT != 0)
|
|| offset_bitpos % TARGET_CHAR_BIT != 0)
|
||||||
{
|
{
|
||||||
/* We're dealing with a bitfield. Print the bit offset. */
|
/* We're dealing with a bitfield. Print the bit offset. */
|
||||||
|
|||||||
@@ -3581,7 +3581,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
|||||||
v = value_addr (v);
|
v = value_addr (v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
if (TYPE_FIELD_PACKED (t, i))
|
if (t->field (i).is_packed ())
|
||||||
error (_("pointers to bitfield members not allowed"));
|
error (_("pointers to bitfield members not allowed"));
|
||||||
|
|
||||||
if (want_address)
|
if (want_address)
|
||||||
|
|||||||
Reference in New Issue
Block a user