Fix trailing commas in array literals changing the result of sizeof()

This commit is contained in:
Arkshine
2014-12-08 20:45:33 +01:00
parent 2bba5ce69a
commit a50f104fd3
4 changed files with 26 additions and 3 deletions

View File

@ -2296,6 +2296,7 @@ static cell initarray(int ident,int tag,int dim[],int numdim,int cur,
{
cell dsize,totalsize;
int idx,abortparse;
static char disable = FALSE;
assert(cur>=0 && cur<numdim);
assert(startlit>=0);
@ -2332,6 +2333,13 @@ static cell initarray(int ident,int tag,int dim[],int numdim,int cur,
totalsize+=dsize;
if (*errorfound || !matchtoken(','))
abortparse=TRUE;
disable = sLiteralQueueDisabled;
sLiteralQueueDisabled = TRUE;
if (matchtoken('}')) {
abortparse = TRUE;
lexpush();
}
sLiteralQueueDisabled = disable;
} /* for */
needtoken('}');
assert(counteddim!=NULL);