2012-04-17 Pedro Alves <palves@redhat.com>

* gdbtypes.h (FIELD_BITPOS): Rename to ...
	(FIELD_BITPOS_LVAL): ... this.
	(FIELD_BITPOS): New.
	(SET_FIELD_BITPOS): Adjust to use FIELD_BITPOS_LVAL.
	* dwarf2read.c (dwarf2_add_field): Use SET_FIELD_BITPOS.
	* gdbtypes.c (append_composite_type_field_aligned): Adjust to use
	SET_FIELD_BITPOS.
	* gnu-v3-abi.c (build_gdb_vtable_type): Adjust to use
	SET_FIELD_BITPOS.
	* stabsread.c (read_cpp_abbrev, read_one_struct_field)
	(read_baseclasses): Adjust to use SET_FIELD_BITPOS.
	* target-descriptions.c (tdesc_gdb_type): Adjust to use
	SET_FIELD_BITPOS.
This commit is contained in:
Pedro Alves 2012-04-17 13:55:32 +00:00
parent 945b3a3230
commit f41f5e616a
7 changed files with 40 additions and 19 deletions

View File

@ -1,3 +1,19 @@
2012-04-17 Pedro Alves <palves@redhat.com>
* gdbtypes.h (FIELD_BITPOS): Rename to ...
(FIELD_BITPOS_LVAL): ... this.
(FIELD_BITPOS): New.
(SET_FIELD_BITPOS): Adjust to use FIELD_BITPOS_LVAL.
* dwarf2read.c (dwarf2_add_field): Use SET_FIELD_BITPOS.
* gdbtypes.c (append_composite_type_field_aligned): Adjust to use
SET_FIELD_BITPOS.
* gnu-v3-abi.c (build_gdb_vtable_type): Adjust to use
SET_FIELD_BITPOS.
* stabsread.c (read_cpp_abbrev, read_one_struct_field)
(read_baseclasses): Adjust to use SET_FIELD_BITPOS.
* target-descriptions.c (tdesc_gdb_type): Adjust to use
SET_FIELD_BITPOS.
2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Do not rely on FIELD_LOC_KIND_BITPOS being zero.

View File

@ -7066,7 +7066,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
anonymous object to the MSB of the field. We don't
have to do anything special since we don't need to
know the size of the anonymous object. */
FIELD_BITPOS (*fp) += DW_UNSND (attr);
SET_FIELD_BITPOS (*fp, FIELD_BITPOS (*fp) + DW_UNSND (attr));
}
else
{
@ -7095,8 +7095,10 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
bit field. */
anonymous_size = TYPE_LENGTH (fp->type);
}
FIELD_BITPOS (*fp) += anonymous_size * bits_per_byte
- bit_offset - FIELD_BITSIZE (*fp);
SET_FIELD_BITPOS (*fp,
(FIELD_BITPOS (*fp)
+ anonymous_size * bits_per_byte
- bit_offset - FIELD_BITSIZE (*fp)));
}
}

View File

@ -3666,9 +3666,10 @@ append_composite_type_field_aligned (struct type *t, char *name,
TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field);
if (TYPE_NFIELDS (t) > 1)
{
FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
+ (TYPE_LENGTH (FIELD_TYPE (f[-1]))
* TARGET_CHAR_BIT));
SET_FIELD_BITPOS (f[0],
(FIELD_BITPOS (f[-1])
+ (TYPE_LENGTH (FIELD_TYPE (f[-1]))
* TARGET_CHAR_BIT)));
if (alignment)
{
@ -3679,7 +3680,7 @@ append_composite_type_field_aligned (struct type *t, char *name,
if (left)
{
FIELD_BITPOS (f[0]) += (alignment - left);
SET_FIELD_BITPOS (f[0], FIELD_BITPOS (f[0]) + (alignment - left));
TYPE_LENGTH (t) += (alignment - left) / TARGET_CHAR_BIT;
}
}

View File

@ -1087,13 +1087,14 @@ extern void allocate_gnat_aux_type (struct type *);
#define FIELD_TYPE(thisfld) ((thisfld).type)
#define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
#define FIELD_BITPOS(thisfld) (FIELD_BITPOS_LVAL (thisfld) + 0)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
FIELD_BITPOS (thisfld) = (bitpos))
FIELD_BITPOS_LVAL (thisfld) = (bitpos))
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))

View File

@ -130,28 +130,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
/* ptrdiff_t vcall_and_vbase_offsets[0]; */
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
FIELD_TYPE (*field) = lookup_array_range_type (ptrdiff_type, 0, -1);
FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* ptrdiff_t offset_to_top; */
FIELD_NAME (*field) = "offset_to_top";
FIELD_TYPE (*field) = ptrdiff_type;
FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* void *type_info; */
FIELD_NAME (*field) = "type_info";
FIELD_TYPE (*field) = void_ptr_type;
FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* void (*virtual_functions[0]) (); */
FIELD_NAME (*field) = "virtual_functions";
FIELD_TYPE (*field) = lookup_array_range_type (ptr_to_void_fn_type, 0, -1);
FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;

View File

@ -2830,8 +2830,8 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
{
int nbits;
FIELD_BITPOS (fip->list->field) = read_huge_number (pp, ';', &nbits,
0);
SET_FIELD_BITPOS (fip->list->field,
read_huge_number (pp, ';', &nbits, 0));
if (nbits != 0)
return 0;
}
@ -2907,7 +2907,8 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p,
{
int nbits;
FIELD_BITPOS (fip->list->field) = read_huge_number (pp, ',', &nbits, 0);
SET_FIELD_BITPOS (fip->list->field,
read_huge_number (pp, ',', &nbits, 0));
if (nbits != 0)
{
stabs_general_complaint ("bad structure-type format");
@ -3187,7 +3188,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
corresponding to this baseclass. Always zero in the absence of
multiple inheritance. */
FIELD_BITPOS (new->field) = read_huge_number (pp, ',', &nbits, 0);
SET_FIELD_BITPOS (new->field, read_huge_number (pp, ',', &nbits, 0));
if (nbits != 0)
return 0;
}

View File

@ -657,9 +657,9 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
bitsize = f->end - f->start + 1;
total_size = tdesc_type->u.u.size * TARGET_CHAR_BIT;
if (gdbarch_bits_big_endian (gdbarch))
FIELD_BITPOS (fld[0]) = total_size - f->start - bitsize;
SET_FIELD_BITPOS (fld[0], total_size - f->start - bitsize);
else
FIELD_BITPOS (fld[0]) = f->start;
SET_FIELD_BITPOS (fld[0], f->start);
FIELD_BITSIZE (fld[0]) = bitsize;
}
else