History

Revert "Reject jumping inside stmtexprs"

Not fully thought out. You can't jump inside stmt exprs, but you can jump out of them. So there's a difference between undefined but declared labels at the end of stmt exprs and those defined inside. Additionally it should also be checked if a label defined inside a stmt expr was tentatively created as declared from outside. I'm not prepared doing that right now, so simply revert. This reverts commit 9160e4cab9147d77840cc44a285031fdb4640cf9.

Michael Matz committed 10 years ago

Commit b303a001 parent d4d31441 file · +1 −7Browse files

Unified · Split

tccgen.c+1−7
@@ -5418,7 +5418,7 @@ static void block(int *bsym, int *csym, int is_expr) · 5417 unmodified lines
5418 gsym(a);5418 gsym(a);
5419 gsym_addr(b, d);5419 gsym_addr(b, d);
5420 } else if (tok == '{') {5420 } else if (tok == '{') {
5421 Sym *llabel, *glabel;5421 Sym *llabel;
5422 int block_vla_sp_loc = vla_sp_loc, saved_vlas_in_scope = vlas_in_scope;5422 int block_vla_sp_loc = vla_sp_loc, saved_vlas_in_scope = vlas_in_scope;
5423 5423
5424 next();5424 next();
@@ -5426,10 +5426,6 @@ static void block(int *bsym, int *csym, int is_expr) · 1 unmodified line
5426 s = local_stack;5426 s = local_stack;
5427 llabel = local_label_stack;5427 llabel = local_label_stack;
5428 ++local_scope;5428 ++local_scope;
5429 /* Labels defined inside statement expressions aren't
5430 available from the outside, so record that as well. */
5431 if (is_expr)
5432 glabel = global_label_stack;
5433 5429
5434 /* handle local labels declarations */5430 /* handle local labels declarations */
5435 if (tok == TOK_LABEL) {5431 if (tok == TOK_LABEL) {
@@ -5455,8 +5451,6 @@ static void block(int *bsym, int *csym, int is_expr) · 19 unmodified lines
5455 block(bsym, csym, is_expr);5451 block(bsym, csym, is_expr);
5456 }5452 }
5457 }5453 }
5458 if (is_expr)
5459 label_pop(&global_label_stack, glabel);
5460 /* pop locally defined labels */5454 /* pop locally defined labels */
5461 label_pop(&local_label_stack, llabel);5455 label_pop(&local_label_stack, llabel);
5462 /* pop locally defined symbols */5456 /* pop locally defined symbols */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t