Merge pull request #270 from YashasSamaga/fix-i254

trigger unused symbol warning for references
This commit is contained in:
Southclaws 2018-01-28 12:45:44 +00:00 committed by GitHub
commit 0f5007c538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4183,8 +4183,6 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
assert(numtags>0);
argsym=addvariable(name,offset,ident,sLOCAL,tags[0],
arg->dim,arg->numdim,arg->idxtag,0);
if (ident==iREFERENCE)
argsym->usage|=uREAD; /* because references are passed back */
if (fpublic)
argsym->usage|=uREAD; /* arguments of public functions are always "used" */
if (fconst)
@ -4860,7 +4858,7 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
errorset(sSETPOS,sym->lnumber);
error(203,sym->name,sym->lnumber); /* symbol isn't used (and not stock) */
errorset(sSETPOS,-1);
} else if ((sym->usage & (uREAD | uSTOCK | uPUBLIC))==0) {
} else if ((sym->usage & (uREAD | uSTOCK | uPUBLIC))==0 && sym->ident!=iREFERENCE) {
errorset(sSETPOS,sym->lnumber);
error(204,sym->name); /* value assigned to symbol is never used */
errorset(sSETPOS,-1);