* 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 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.
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
{
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)));
}
}
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)
{
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;
}
}
#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))
/* 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++;
{
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;
}
{
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");
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;
}
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