Fix bitfield accounting, as I was assuming that the first field would be

at the 0 offset, but its not, so just look if the last member was in a
bitfield.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2006-10-25 12:01:18 -03:00
parent d4c95e9b49
commit e45d94f9de
1 changed files with 3 additions and 1 deletions

View File

@ -261,6 +261,7 @@ void class__print(struct class *self)
struct class_member *pos;
char name[128];
size_t last_size = 0;
int last_bit_size = 0;
int last_offset = -1;
printf("%56.56s /* offset size */\n", "");
@ -294,9 +295,10 @@ void class__print(struct class *self)
* check for bitfields, accounting only the first
* field.
*/
if (pos->bit_size == 0 || pos->bit_offset == 0)
if (pos->bit_size == 0 || last_bit_size == 0)
sum += last_size;
last_offset = pos->offset;
last_bit_size = pos->bit_size;
}
if (last_offset != -1 && last_offset + last_size != self->size) {