From 9839b601773fecd1145b817f61980978c4af35e8 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sat, 15 Apr 2017 20:05:39 +0200 Subject: [PATCH] Remove label_or_decl The only use of this function can be rewritten in terms of is_label (if one other use of that one are a bit amended). --- tccgen.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) 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)