diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index e0d9969d..b8ef545d 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -2711,6 +2711,23 @@ static void initials2(int ident,int tag,cell *size,int dim[],int numdim, eq_match_override = matchtoken('='); } + if (numdim > 2) { + int d, hasEmpty = 0; + for (d = 0; d < numdim; d++) { + if (dim[d] == 0) + hasEmpty++; + } + /* Work around ambug 4977 where indirection vectors are computed wrong. */ + if (hasEmpty && hasEmpty < numdim-1 && dim[numdim-1]) { + error(101); + /* This will assert with something like [2][][256] from a separate bug. + * To prevent this assert, automatically wipe the rest of the dims. + */ + for (d = 0; d < numdim - 1; d++) + dim[d] = 0; + } + } + if (!eq_match_override) { assert(ident!=iARRAY || numdim>0); if (ident==iARRAY && dim[numdim-1]==0) { diff --git a/sourcepawn/compiler/sc5.c b/sourcepawn/compiler/sc5.c index c310d836..49e01a80 100644 --- a/sourcepawn/compiler/sc5.c +++ b/sourcepawn/compiler/sc5.c @@ -74,7 +74,6 @@ static int lastline,errorcount; static short lastfile; char *msg,*pre; va_list argptr; - char string[128]; /* errflag is reset on each semicolon. * In a two-pass compiler, an error should not be reported twice. Therefore @@ -107,8 +106,6 @@ static short lastfile; warnnum++; } /* if */ - strexpand(string,(unsigned char *)msg,sizeof string,SCPACK_TABLE); - assert(errstart<=fline); if (errline>0) errstart=errline; @@ -118,7 +115,7 @@ static short lastfile; va_start(argptr,number); if (strlen(errfname)==0) { int start= (errstart==errline) ? -1 : errstart; - if (pc_error(number,string,inpfname,start,errline,argptr)) { + if (pc_error(number,msg,inpfname,start,errline,argptr)) { if (outf!=NULL) { pc_closeasm(outf,TRUE); outf=NULL; @@ -132,7 +129,7 @@ static short lastfile; fprintf(fp,"%s(%d -- %d) : %s %03d: ",inpfname,errstart,errline,pre,number); else fprintf(fp,"%s(%d) : %s %03d: ",inpfname,errline,pre,number); - vfprintf(fp,string,argptr); + vfprintf(fp,msg,argptr); fclose(fp); } /* if */ } /* if */ diff --git a/sourcepawn/compiler/sc5.scp b/sourcepawn/compiler/sc5.scp index 62bd2d9d..6d32eb5b 100644 --- a/sourcepawn/compiler/sc5.scp +++ b/sourcepawn/compiler/sc5.scp @@ -38,7 +38,7 @@ unsigned char errstr_table[][2] = { /*-*SCPACK end of pair table, do not change or remove this line */ static char *errmsg[] = { -#ifdef SCPACK +#if 1 /*001*/ "expected token: \"%s\", but found \"%s\"\n", /*002*/ "only a single statement (or expression) can follow each \"case\"\n", /*003*/ "declaration of a local variable must appear in a compound block\n", @@ -138,7 +138,8 @@ static char *errmsg[] = { /*097*/ "symbol \"%s\" does not have a matching type\n", /*098*/ "struct requires unique struct name\n", /*099*/ "member \"%s\" appears more than once in struct \"%s\"\n", -/*100*/ "function prototypes do not match\n" +/*100*/ "function prototypes do not match\n", +/*101*/ "specify either all dimensions or only the last dimension\n" #else "\271pect\236\305k\212:\231\320bu\202fo\217\207\215\012", "\201l\224\251s\203g\362\317e\234\202(\260\374\201) c\352f\241\345w ea\261 \042c\361e\042\012", @@ -244,7 +245,7 @@ static char *errmsg[] = { }; static char *fatalmsg[] = { -#ifdef SCPACK +#if 1 /*120*/ "cannot read from file: \"%s\"\n", /*121*/ "cannot write to file: \"%s\"\n", /*122*/ "table overflow: \"%s\"\n", @@ -280,7 +281,7 @@ static char *fatalmsg[] = { }; static char *warnmsg[] = { -#ifdef SCPACK +#if 1 /*200*/ "symbol \"%s\" is truncated to %d characters\n", /*201*/ "redefinition of constant/macro (symbol \"%s\")\n", /*202*/ "number of arguments does not match definition\n",