Skip to contentSkip to conversation

Try to teach sparse about construct like 'struct __attribute__((foo)) bar'

PATCH Luc Van Oostenryck 2 participants 2 messages Jan 18, 2006 Sparse checker

lore
Share & tools
lore
#0 lore raw

On the current linux git tree, sparse spit a lot of errors:
include/asm/lppaca.h:34:8: error: Trying to use reserved word '__attribute__' as identifier

which is caused by a declaration:

	struct __attribute__((__aligned__(0x400))) lppaca {

The following patch seems to solve the symptom but I'm not sure that the ctype is not handled correctly.
Also, now sparse produce a lot of others errors, mainly about address space mismatch like:
init/do_mounts.c:69:16: warning: incorrect type in argument 1 (different address spaces)
init/do_mounts.c:69:16: expected char const [noderef] *filename<asn:1>
init/do_mounts.c:69:16: got char *<noident>

What is strange is that these warning seems to be about a real address space problem but why sparse didn't warn before?
(IIRC, the warnings in init/do_mounts.c were reported by sparse some time ago).

---

parse.c +2 -0
index d871afd..3c071d6 100644
@@ -34,6 +34,7 @@ struct symbol_list *function_computed_ta
 struct statement_list *function_computed_goto_list;
 
 static struct token *statement(struct token *token, struct statement **tree);
+static struct token *handle_attributes(struct token *token, struct ctype *ctype);
 
 // Add a symbol to the list of function-local symbols
 static void fn_local_symbol(struct symbol *sym)
@@ -112,6 +113,7 @@ static struct token *struct_union_enum_s
 	struct position *repos;
 
 	ctype->modifiers = 0;
+	token = handle_attributes(token, ctype);
 	if (token_type(token) == TOKEN_IDENT) {
 		sym = lookup_symbol(token->ident, NS_STRUCT);
 		if (!sym ||
#1 lore raw
Quoted 5 lines · Luc Van Oostenryck

On the current linux git tree, sparse spit a lot of errors:
include/asm/lppaca.h:34:8: error: Trying to use reserved word '__attribute__' as identifier

which is caused by a declaration:

	struct __attribute__((__aligned__(0x400))) lppaca {

Funny, I just posted a patch to lkml regarding this. It'll be in the next -mm patch.

	<b