diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-10-05 17:58:28 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-12-29 14:44:21 +0100 |
| commit | 2cf493d1f63f075e6fe0cccbcb7463b1aa773a74 (patch) | |
| tree | a673b2a8ad549a2631936ef54d141731859dc2e3 /parse.c | |
| parent | f07a1053a90039a2d88ed62f74add2ee131d67b7 (diff) | |
| download | sparse-dev-2cf493d1f63f075e6fe0cccbcb7463b1aa773a74.tar.gz | |
packed: add support for __packed struct
Now that the 'packed' attribute is parsed and propagated into
the type system, adapt the layout of structures.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -767,6 +767,7 @@ static struct token *struct_union_enum_specifier(enum type type, attr.ctype.base_type = sym; token = handle_attributes(token, &attr); apply_ctype(token->pos, &sym->ctype, &attr.ctype); + sym->packed = attr.packed; sym->endpos = token->pos; @@ -1089,8 +1090,10 @@ static struct token *ignore_attribute(struct token *token, struct symbol *attr, static struct token *attribute_packed(struct token *token, struct symbol *attr, struct decl_state *ctx) { - if (!ctx->ctype.alignment) + if (!ctx->ctype.alignment) { ctx->ctype.alignment = 1; + ctx->packed = 1; + } return token; } |
