From 7c81e6573d4d77c2544b0a94bf9e6127d7bd4ed2 Mon Sep 17 00:00:00 2001 From: Double V Date: Sun, 29 Jan 2017 20:20:46 +0300 Subject: [PATCH] Fix some errors with static enums in a block (#141) Signed-off-by: VVWVV --- source/compiler/sc1.c | 7 ++++--- source/compiler/sc5.c | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index df7cea8..fe88dc3 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -2786,8 +2786,6 @@ static void decl_enum(int vclass,int fstatic) short filenum; filenum=fcurrent; - if (fstatic && vclass==sLOCAL) - error(92); /* 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 @@ -5034,7 +5032,9 @@ static void statement(int *lastindent,int allow_decl) } /* if */ break; case tSTATIC: - if (allow_decl) { + if (matchtoken(tENUM)) + decl_enum(sLOCAL,FALSE); + else if (allow_decl) { declloc(TRUE); lastst=tNEW; } else { @@ -5111,6 +5111,7 @@ static void statement(int *lastindent,int allow_decl) decl_const(sLOCAL); break; case tENUM: + matchtoken(tSTATIC); decl_enum(sLOCAL,FALSE); break; default: /* non-empty expression */ diff --git a/source/compiler/sc5.c b/source/compiler/sc5.c index 0ebea1a..c4a5543 100644 --- a/source/compiler/sc5.c +++ b/source/compiler/sc5.c @@ -128,8 +128,7 @@ static char *errmsg[] = { /*088*/ "public variables and local variables may not have states (symbol \"%s\")\n", /*089*/ "state variables may not be initialized (symbol \"%s\")\n", /*090*/ "public functions may not return arrays (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" +/*091*/ "ambiguous constant; tag override is required (symbol \"%s\")\n" }; static char *fatalmsg[] = {