From 455a1c70c1b2d8ecfb267dda8a6a5f6f8baf4233 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 13 Apr 2020 14:06:59 -0700 Subject: [PATCH 1/3] Rename 'symbol_scope' to 'block_scope' The actual scope variable was already named that way, but the begin/end functions inexplicably weren't. --- expression.c | 4 ++-- parse.c | 12 ++++++------ scope.c | 4 ++-- scope.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/expression.c b/expression.c index 5b9bddfe..40141a5e 100644 --- a/expression.c +++ b/expression.c @@ -71,9 +71,9 @@ struct token *parens_expression(struct token *token, struct expression **expr, c struct statement *stmt = alloc_statement(token->pos, STMT_COMPOUND); *expr = e; e->statement = stmt; - start_symbol_scope(); + start_block_scope(); token = compound_statement(token->next, stmt); - end_symbol_scope(); + end_block_scope(); token = expect(token, '}', "at end of statement expression"); } else token = parse_expression(token, expr); diff --git a/parse.c b/parse.c index a29c67c8..9d11309e 100644 --- a/parse.c +++ b/parse.c @@ -2222,7 +2222,7 @@ static void start_iterator(struct statement *stmt) { struct symbol *cont, *brk; - start_symbol_scope(); + start_block_scope(); cont = alloc_symbol(stmt->pos, SYM_NODE); bind_symbol(cont, &continue_ident, NS_ITERATOR); brk = alloc_symbol(stmt->pos, SYM_NODE); @@ -2237,7 +2237,7 @@ static void start_iterator(struct statement *stmt) static void end_iterator(struct statement *stmt) { - end_symbol_scope(); + end_block_scope(); } static struct statement *start_function(struct symbol *sym) @@ -2282,7 +2282,7 @@ static void start_switch(struct statement *stmt) { struct symbol *brk, *switch_case; - start_symbol_scope(); + start_block_scope(); brk = alloc_symbol(stmt->pos, SYM_NODE); bind_symbol(brk, &break_ident, NS_ITERATOR); @@ -2302,7 +2302,7 @@ static void end_switch(struct statement *stmt) { if (!stmt->switch_case->symbol_list) warning(stmt->pos, "switch with no cases"); - end_symbol_scope(); + end_block_scope(); } static void add_case_statement(struct statement *stmt) @@ -2548,9 +2548,9 @@ static struct token *statement(struct token *token, struct statement **tree) if (match_op(token, '{')) { stmt->type = STMT_COMPOUND; - start_symbol_scope(); + start_block_scope(); token = compound_statement(token->next, stmt); - end_symbol_scope(); + end_block_scope(); return expect(token, '}', "at end of compound statement"); } diff --git a/scope.c b/scope.c index 420c0f5a..a0de2e0d 100644 --- a/scope.c +++ b/scope.c @@ -86,7 +86,7 @@ void start_file_scope(void) block_scope = scope; } -void start_symbol_scope(void) +void start_block_scope(void) { start_scope(&block_scope); } @@ -131,7 +131,7 @@ void new_file_scope(void) start_file_scope(); } -void end_symbol_scope(void) +void end_block_scope(void) { end_scope(&block_scope); } diff --git a/scope.h b/scope.h index 3cad514a..83741459 100644 --- a/scope.h +++ b/scope.h @@ -47,8 +47,8 @@ extern void start_file_scope(void); extern void end_file_scope(void); extern void new_file_scope(void); -extern void start_symbol_scope(void); -extern void end_symbol_scope(void); +extern void start_block_scope(void); +extern void end_block_scope(void); extern void start_function_scope(void); extern void end_function_scope(void); -- 2.24.0.158.g3fed155289