[PATCH v2 13/16] struct-attr: fix type attribute like 'struct __attr { ... }'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In a declaration like:
	struct <some attribute> { ... }
the attribute belong to the type but is currently handled as belonging
to the whole declaration.

Fix this by handling such attributes in a local 'decl_state' and
applying them once the closing '}' is reached.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/parse.c b/parse.c
index a67d567145d0..5f33ac178a45 100644
--- a/parse.c
+++ b/parse.c
@@ -719,10 +719,11 @@ static struct token *struct_union_enum_specifier(enum type type,
 	struct token *token, struct decl_state *ctx,
 	struct token *(*parse)(struct token *, struct symbol *))
 {
+	struct decl_state attr = { };
 	struct symbol *sym;
 	struct position *repos;
 
-	token = handle_attributes(token, ctx);
+	token = handle_attributes(token, &attr);
 	if (token_type(token) == TOKEN_IDENT) {
 		sym = lookup_symbol(token->ident, NS_STRUCT);
 		if (!sym ||
@@ -760,6 +761,7 @@ static struct token *struct_union_enum_specifier(enum type type,
 	token = parse(token->next, sym);
 	ctx->ctype.base_type = sym;
 	token =  expect(token, '}', "at end of specifier");
+	apply_ctype(token->pos, &sym->ctype, &attr.ctype);
 
 	// Mark the structure as needing re-examination
 	sym->examined = 0;
-- 
2.29.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux