Fix some errors with static enums in a block (#141)

Signed-off-by: VVWVV <d0u61ev@gmail.com>
This commit is contained in:
Double V 2017-01-29 20:20:46 +03:00 committed by Zeex
parent 07d0db48d7
commit 7c81e6573d
2 changed files with 5 additions and 5 deletions

View File

@ -2786,8 +2786,6 @@ static void decl_enum(int vclass,int fstatic)
short filenum; short filenum;
filenum=fcurrent; filenum=fcurrent;
if (fstatic && vclass==sLOCAL)
error(92);
/* get an explicit tag, if any (we need to remember whether an explicit /* get an explicit tag, if any (we need to remember whether an explicit
* tag was passed, even if that explicit tag was "_:", so we cannot call * tag was passed, even if that explicit tag was "_:", so we cannot call
@ -5034,7 +5032,9 @@ static void statement(int *lastindent,int allow_decl)
} /* if */ } /* if */
break; break;
case tSTATIC: case tSTATIC:
if (allow_decl) { if (matchtoken(tENUM))
decl_enum(sLOCAL,FALSE);
else if (allow_decl) {
declloc(TRUE); declloc(TRUE);
lastst=tNEW; lastst=tNEW;
} else { } else {
@ -5111,6 +5111,7 @@ static void statement(int *lastindent,int allow_decl)
decl_const(sLOCAL); decl_const(sLOCAL);
break; break;
case tENUM: case tENUM:
matchtoken(tSTATIC);
decl_enum(sLOCAL,FALSE); decl_enum(sLOCAL,FALSE);
break; break;
default: /* non-empty expression */ default: /* non-empty expression */

View File

@ -128,8 +128,7 @@ static char *errmsg[] = {
/*088*/ "public variables and local variables may not have states (symbol \"%s\")\n", /*088*/ "public variables and local variables may not have states (symbol \"%s\")\n",
/*089*/ "state variables may not be initialized (symbol \"%s\")\n", /*089*/ "state variables may not be initialized (symbol \"%s\")\n",
/*090*/ "public functions may not return arrays (symbol \"%s\")\n", /*090*/ "public functions may not return arrays (symbol \"%s\")\n",
/*091*/ "ambiguous constant; tag override is required (symbol \"%s\")\n", /*091*/ "ambiguous constant; tag override is required (symbol \"%s\")\n"
/*092*/ "static enums may not be declared in a compound block\n"
}; };
static char *fatalmsg[] = { static char *fatalmsg[] = {