Revert "Fix error when static/stock/public constant used as array size"

This reverts commit 39828f23f2967e78a2f0f981cbfa81e777adbef7.

Conflicts:
	source/compiler/sc1.c
This commit is contained in:
Zeex 2015-06-23 21:44:02 +06:00
parent d8f824357f
commit b261bacfa4

View File

@ -1860,13 +1860,8 @@ static void declfuncvar(int fpublic,int fstatic,int fstock,int fconst)
/* only variables can be "const" or both "public" and "stock" */ /* only variables can be "const" or both "public" and "stock" */
invalidfunc= fconst || (fpublic && fstock); invalidfunc= fconst || (fpublic && fstock);
if (invalidfunc || !newfunc(name,tag,fpublic,fstatic,fstock)) { if (invalidfunc || !newfunc(name,tag,fpublic,fstatic,fstock)) {
/* if not a function, try a global constant/variable */ /* if not a function, try a global variable */
if (fconst && !fpublic) { declglb(name,tag,fpublic,fstatic,fstock,fconst);
lexpush();
decl_const(sGLOBAL);
} else {
declglb(name,tag,fpublic,fstatic,fstock,fconst);
} /* if */
} /* if */ } /* if */
} /* if */ } /* if */
} }
@ -4953,14 +4948,8 @@ static void statement(int *lastindent,int allow_decl)
break; break;
case tSTATIC: case tSTATIC:
if (allow_decl) { if (allow_decl) {
tok=lex(&val,&st); declloc(TRUE);
if (tok==tCONST) { lastst=tNEW;
decl_const(sSTATIC);
} else {
lexpush();
declloc(TRUE);
lastst=tNEW;
} /* if */
} else { } else {
error(3); /* declaration only valid in a block */ error(3); /* declaration only valid in a block */
} /* if */ } /* if */