aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tccgen.c b/tccgen.c
index 2c759e1..6031611 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -4286,6 +4286,25 @@ static int is_label(void)
}
}
+static void label_or_decl(int l)
+{
+ int last_tok;
+
+ /* fast test first */
+ if (tok >= TOK_UIDENT)
+ {
+ /* no need to save tokc because tok is an identifier */
+ last_tok = tok;
+ next();
+ if (tok == ':') {
+ unget_tok(last_tok);
+ return;
+ }
+ unget_tok(last_tok);
+ }
+ decl(l);
+}
+
static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
int case_reg, int is_expr)
{
@@ -4359,7 +4378,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
}
}
while (tok != '}') {
- decl(VT_LOCAL);
+ label_or_decl(VT_LOCAL);
if (tok != '}') {
if (is_expr)
vpop();