Reset errline to -1 instead of 0

This commit is contained in:
Zeex 2018-01-12 20:26:45 +06:00
parent 0d9bb02970
commit 9a21fb5a2f
2 changed files with 8 additions and 8 deletions

View File

@ -2858,7 +2858,7 @@ static void decl_const(int vclass)
/* temporarily reset the line number to where the symbol was defined */
errorset(sSETPOS,symbolline);
error(213); /* tagname mismatch */
errorset(sSETPOS,0);
errorset(sSETPOS,-1);
} /* if */
sym=add_constant(constname,val,vclass,tag);
if (sym!=NULL)
@ -4780,7 +4780,7 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
} else if ((sym->usage & uREAD)==0) {
errorset(sSETPOS,sym->lnumber);
error(203,sym->name); /* symbol isn't used: ... */
errorset(sSETPOS,0);
errorset(sSETPOS,-1);
} /* if */
} /* if */
break;
@ -4800,7 +4800,7 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
if (testconst && (sym->usage & uREAD)==0) {
errorset(sSETPOS,sym->lnumber);
error(203,sym->name); /* symbol isn't used: ... */
errorset(sSETPOS,0);
errorset(sSETPOS,-1);
} /* if */
break;
default:
@ -4810,16 +4810,16 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
if ((sym->usage & (uWRITTEN | uREAD | uSTOCK | uPUBLIC))==0) {
errorset(sSETPOS,sym->lnumber);
error(203,sym->name,sym->lnumber); /* symbol isn't used (and not stock) */
errorset(sSETPOS,0);
errorset(sSETPOS,-1);
} else if ((sym->usage & (uREAD | uSTOCK | uPUBLIC))==0) {
errorset(sSETPOS,sym->lnumber);
error(204,sym->name); /* value assigned to symbol is never used */
errorset(sSETPOS,0);
errorset(sSETPOS,-1);
#if 0 // ??? not sure whether it is a good idea to force people use "const"
} else if ((sym->usage & (uWRITTEN | uPUBLIC | uCONST))==0 && sym->ident==iREFARRAY) {
errorset(sSETPOS,sym->lnumber);
error(214,sym->name); /* make array argument "const" */
errorset(sSETPOS,0);
errorset(sSETPOS,-1);
#endif
} /* if */
/* also mark the variable (local or global) to the debug information */

View File

@ -269,7 +269,7 @@ static short lastfile;
assert(errstart<=errline);
va_start(argptr,number);
if (strlen(errfname)==0) {
int start= (errstart==errline) ? -1 : errstart;
int start=(errstart==errline) ? -1 : errstart;
if (pc_error(number,msg,inpfname,start,errline,argptr)) {
if (outf!=NULL) {
pc_closeasm(outf,TRUE);
@ -356,7 +356,7 @@ int pc_enablewarning(int number,int enable)
if (number<200)
return FALSE; /* errors and fatal errors cannot be disabled */
number -= 200;
number-=200;
if (number>=NUM_WARNINGS)
return FALSE;