diff options
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 8 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 9 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 5 | ||||
-rw-r--r-- | gdb/gnu-v3-abi.c | 8 | ||||
-rw-r--r-- | gdb/stabsread.c | 9 | ||||
-rw-r--r-- | gdb/target-descriptions.c | 4 |
7 files changed, 40 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0aec0b1..baf556b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 0e211ae..eec52fb 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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))); } } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 90e33a5..d772d9a 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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; } } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 07c3a86..a2b2432 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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)) diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 1095c60..ed94b84 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -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++; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 39e0d7b..40b2465 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -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; } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index cbcca76..0b12e3e 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -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 |