diff options
author | Michael Forney <mforney@mforney.org> | 2019-04-27 20:33:56 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-04-27 20:38:42 -0700 |
commit | 2b34742bf0dbabbdb7335838902323df66974b39 (patch) | |
tree | 021c5487c20d5bbae5ae12c4ddddf81aad135cc6 /decl.c | |
parent | 1ef0706e1f2e97d0872eb801169de5023c3c8b7f (diff) |
Unnamed bit-fields don't contribute to size or alignment of unions, or size of structs
Diffstat (limited to 'decl.c')
-rw-r--r-- | decl.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -714,17 +714,15 @@ addmember(struct structbuilder *b, struct qualtype mt, char *name, int align, ui } t->size += (width - b->bits + 7) / 8; b->bits = (b->bits - width) % 8; - } else { - if (m) { - m->offset = 0; - m->bits.before = 0; - m->bits.after = mt.type->size * 8 - width; - } + } else if (m) { + m->offset = 0; + m->bits.before = 0; + m->bits.after = mt.type->size * 8 - width; if (t->size < mt.type->size) t->size = mt.type->size; } } - if (t->align < align) + if (m && t->align < align) t->align = align; } |