Fixed amb1580 - trailing comma wasn't allowed in multi-dimensional array initializations
Also bumped compiler copyright year, since the same file was, um, changed --HG-- branch : sourcemod-1.0.1 extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.1%401984
This commit is contained in:
parent
bcb9bc988f
commit
064f57e321
@ -1191,7 +1191,7 @@ static void setconfig(char *root)
|
|||||||
static void setcaption(void)
|
static void setcaption(void)
|
||||||
{
|
{
|
||||||
pc_printf("SourcePawn Compiler " SVN_FULL_VERSION "\n");
|
pc_printf("SourcePawn Compiler " SVN_FULL_VERSION "\n");
|
||||||
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2007 AlliedModders, LLC\n\n");
|
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void about(void)
|
static void about(void)
|
||||||
@ -2777,15 +2777,21 @@ static cell initarray(int ident,int tag,int dim[],int numdim,int cur,
|
|||||||
constvalue *enumroot,int *errorfound)
|
constvalue *enumroot,int *errorfound)
|
||||||
{
|
{
|
||||||
cell dsize,totalsize;
|
cell dsize,totalsize;
|
||||||
int idx,abortparse;
|
int idx,abortparse,needbrace;
|
||||||
|
|
||||||
assert(cur>=0 && cur<numdim);
|
assert(cur>=0 && cur<numdim);
|
||||||
assert(startlit>=0);
|
assert(startlit>=0);
|
||||||
assert(cur+2<=numdim);/* there must be 2 dimensions or more to do */
|
assert(cur+2<=numdim);/* there must be 2 dimensions or more to do */
|
||||||
assert(errorfound!=NULL && *errorfound==FALSE);
|
assert(errorfound!=NULL && *errorfound==FALSE);
|
||||||
totalsize=0;
|
totalsize=0;
|
||||||
|
needbrace=1;
|
||||||
needtoken('{');
|
needtoken('{');
|
||||||
for (idx=0,abortparse=FALSE; !abortparse; idx++) {
|
for (idx=0,abortparse=FALSE; !abortparse; idx++) {
|
||||||
|
if (matchtoken('}'))
|
||||||
|
{
|
||||||
|
needbrace=0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* In case the major dimension is zero, we need to store the offset
|
/* In case the major dimension is zero, we need to store the offset
|
||||||
* to the newly detected sub-array into the indirection table; i.e.
|
* to the newly detected sub-array into the indirection table; i.e.
|
||||||
* this table needs to be expanded and updated.
|
* this table needs to be expanded and updated.
|
||||||
@ -2815,7 +2821,10 @@ static cell initarray(int ident,int tag,int dim[],int numdim,int cur,
|
|||||||
if (*errorfound || !matchtoken(','))
|
if (*errorfound || !matchtoken(','))
|
||||||
abortparse=TRUE;
|
abortparse=TRUE;
|
||||||
} /* for */
|
} /* for */
|
||||||
needtoken('}');
|
if (needbrace)
|
||||||
|
{
|
||||||
|
needtoken('}');
|
||||||
|
}
|
||||||
assert(counteddim!=NULL);
|
assert(counteddim!=NULL);
|
||||||
if (counteddim[cur]>0) {
|
if (counteddim[cur]>0) {
|
||||||
if (idx<counteddim[cur])
|
if (idx<counteddim[cur])
|
||||||
@ -2917,7 +2926,7 @@ static cell initvector(int ident,int tag,cell size,int fillzero,
|
|||||||
if (size==0 || (litidx-curlit)==0)
|
if (size==0 || (litidx-curlit)==0)
|
||||||
error(41); /* invalid ellipsis, array size unknown */
|
error(41); /* invalid ellipsis, array size unknown */
|
||||||
else if ((litidx-curlit)==(int)size)
|
else if ((litidx-curlit)==(int)size)
|
||||||
error(18); /* initialisation data exceeds declared size */
|
error(18); /* initialization data exceeds declared size */
|
||||||
while ((litidx-curlit)<(int)size) {
|
while ((litidx-curlit)<(int)size) {
|
||||||
prev1+=step;
|
prev1+=step;
|
||||||
litadd(prev1);
|
litadd(prev1);
|
||||||
@ -2930,7 +2939,7 @@ static cell initvector(int ident,int tag,cell size,int fillzero,
|
|||||||
if (size==0) {
|
if (size==0) {
|
||||||
size=litidx-curlit; /* number of elements defined */
|
size=litidx-curlit; /* number of elements defined */
|
||||||
} else if (litidx-curlit>(int)size) { /* e.g. "myvar[3]={1,2,3,4};" */
|
} else if (litidx-curlit>(int)size) { /* e.g. "myvar[3]={1,2,3,4};" */
|
||||||
error(18); /* initialisation data exceeds declared size */
|
error(18); /* initialization data exceeds declared size */
|
||||||
litidx=(int)size+curlit; /* avoid overflow in memory moves */
|
litidx=(int)size+curlit; /* avoid overflow in memory moves */
|
||||||
} /* if */
|
} /* if */
|
||||||
return size;
|
return size;
|
||||||
|
Loading…
Reference in New Issue
Block a user