aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-04-18 16:37:47 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-21 17:27:45 +0200
commit5e8b78ce213f2110343a0a6c10a28a3c6797314e (patch)
tree7b3ed74e8007b52b06378b8c9e41bf331cde8c34
parentc1b89f892ebef693da906685cd72c39f1f38c8ff (diff)
downloadsparse-5e8b78ce213f2110343a0a6c10a28a3c6797314e.tar.gz
scope: __label__ is special
Labels declared wth __label__ are special because they must follow the block scope normally used for variables instad of using the scope used for labels. So, use bind_symbol_with_scope() instead of first using bind_symbol() and then changing the namespace. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index e23c5b64..29e3f939 100644
--- a/parse.c
+++ b/parse.c
@@ -2569,8 +2569,7 @@ static struct token *label_statement(struct token *token)
while (token_type(token) == TOKEN_IDENT) {
struct symbol *sym = alloc_symbol(token->pos, SYM_LABEL);
/* it's block-scope, but we want label namespace */
- bind_symbol(sym, token->ident, NS_SYMBOL);
- sym->namespace = NS_LABEL;
+ bind_symbol_with_scope(sym, token->ident, NS_LABEL, block_scope);
fn_local_symbol(sym);
token = token->next;
if (!match_op(token, ','))