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).
master
Michael Matz 2017-04-15 20:05:39 +02:00
parent c7dbc900c8
commit 9839b60177
1 changed files with 5 additions and 21 deletions

View File

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