aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-03 12:40:08 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:03:56 -0700
commit19da63710dc5cee1e0282e2f902753d8d1f64bdf (patch)
tree18636f980353e9c9622aad1d49ea7092ae7139be /symbol.c
parentMake bitfield assignment type evaluation aware of the bit offset. (diff)
downloadsparse-19da63710dc5cee1e0282e2f902753d8d1f64bdf.tar.gz
sparse-19da63710dc5cee1e0282e2f902753d8d1f64bdf.tar.bz2
sparse-19da63710dc5cee1e0282e2f902753d8d1f64bdf.zip
Remove "fieldwidth" member of struct symbol
It's always the same as bit_size now, and having it just confuses things. We now check whether we have examined a type by looking at the "examined" bitfield, which allows us to set bit_size in the early parsing phase.
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/symbol.c b/symbol.c
index 19afda0..b306808 100644
--- a/symbol.c
+++ b/symbol.c
@@ -131,7 +131,7 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
unsigned long bit_offset = bit_size & align_bit_mask;
int room = bitfield_base_size(sym) - bit_offset;
// Zero-width fields just fill up the unit.
- int width = sym->fieldwidth ? sym->fieldwidth : (bit_offset ? room : 0);
+ int width = base_size ? : (bit_offset ? room : 0);
if (width > room) {
bit_size = (bit_size + align_bit_mask) & ~align_bit_mask;
@@ -223,16 +223,12 @@ static struct symbol *examine_bitfield_type(struct symbol *sym)
if (!base_type)
return sym;
bit_size = base_type->bit_size;
- if (sym->fieldwidth > bit_size) {
- warning(sym->pos, "impossible field-width, %d, for this type",
- sym->fieldwidth);
- sym->fieldwidth = bit_size;
- }
+ if (sym->bit_size > bit_size)
+ warning(sym->pos, "impossible field-width, %d, for this type", sym->bit_size);
alignment = base_type->ctype.alignment;
if (!sym->ctype.alignment)
sym->ctype.alignment = alignment;
- sym->bit_size = sym->fieldwidth;
return sym;
}
@@ -295,8 +291,6 @@ static struct symbol * examine_node_type(struct symbol *sym)
bit_size = base_type->bit_size;
alignment = base_type->ctype.alignment;
- if (base_type->fieldwidth)
- sym->fieldwidth = base_type->fieldwidth;
if (!sym->ctype.alignment)
sym->ctype.alignment = alignment;
@@ -358,8 +352,9 @@ struct symbol *examine_symbol_type(struct symbol * sym)
return sym;
/* Already done? */
- if (sym->bit_size)
+ if (sym->examined)
return sym;
+ sym->examined = 1;
switch (sym->type) {
case SYM_FN: