diff --git a/tccgen.c b/tccgen.c index 30a8969f..a52cb038 100644 --- a/tccgen.c +++ b/tccgen.c @@ -5350,7 +5350,6 @@ static int is_label(void) last_tok = tok; next(); if (tok == ':') { - next(); return last_tok; } else { unget_tok(last_tok); @@ -5358,25 +5357,6 @@ 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); -} - #ifndef TCC_TARGET_ARM64 static void gfunc_return(CType *func_type) { @@ -5601,7 +5581,10 @@ static void block(int *bsym, int *csym, int is_expr) } } while (tok != '}') { - label_or_decl(VT_LOCAL); + if ((a = is_label())) + unget_tok(a); + else + decl(VT_LOCAL); if (tok != '}') { if (is_expr) vpop(); @@ -5826,6 +5809,7 @@ static void block(int *bsym, int *csym, int is_expr) b = is_label(); if (b) { /* label case */ + next(); s = label_find(b); if (s) { if (s->r == LABEL_DEFINED)