Perform local label lookup This patch fix the sparse breakage triggered by rcu_read_lock() lockdep annotations. Now sparse look up the local label in symbol node name space as well, just like looking up a normal symbol node. Now a lable symbol can be both type SYM_LABEL or SYM_NODE with MOD_LABEL. Singed-Off-By: Christopher Li Index: sparse/parse.c =================================================================== --- sparse.orig/parse.c 2007-10-19 13:52:37.000000000 -0700 +++ sparse/parse.c 2007-10-19 13:55:23.000000000 -0700 @@ -459,6 +459,16 @@ static struct symbol *lookup_or_create_s return sym; } +static struct symbol * local_label(struct token *token) +{ + struct symbol *sym = lookup_symbol(token->ident, NS_SYMBOL); + + if (sym && sym->ctype.modifiers & MOD_LABEL) + return sym; + + return NULL; +} + /* * NOTE! NS_LABEL is not just a different namespace, * it also ends up using function scope instead of the @@ -466,6 +476,9 @@ static struct symbol *lookup_or_create_s */ struct symbol *label_symbol(struct token *token) { + struct symbol *sym = local_label(token); + if (sym) + return sym; return lookup_or_create_symbol(NS_LABEL, SYM_LABEL, token); } Index: sparse/validation/local-label.c =================================================================== --- sparse.orig/validation/local-label.c 2007-10-19 13:52:40.000000000 -0700 +++ sparse/validation/local-label.c 2007-10-19 13:52:40.000000000 -0700 @@ -0,0 +1,8 @@ +void f(unsigned long ip); +static void g(void) +{ + if (1) { + f(({ __label__ x; x: (unsigned long)&&x; })); + } + f(({ __label__ x; x: (unsigned long)&&x; })); +}