check array depends for modifications for W214

This commit is contained in:
Yashas 2018-06-24 10:15:03 +05:30 committed by YashasSamaga
parent 116ec5f0fd
commit ffb161ad95

View File

@ -4907,9 +4907,20 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
error(204,sym->name); /* value assigned to symbol is never used */
errorset(sSETPOS,-1);
} 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,-1);
int warn = 1;
symbol* depend = finddepend(sym);
while (depend != NULL) {
if ((depend->usage & (uWRITTEN | uPUBLIC | uCONST)) != 0) {
warn = 0;
break;
}
depend = finddepend(depend);
} /* while */
if (warn) {
errorset(sSETPOS, sym->lnumber);
error(214, sym->name); /* make array argument "const" */
errorset(sSETPOS, -1);
} /* if */
} /* if */
/* also mark the variable (local or global) to the debug information */
if ((sym->usage & (uWRITTEN | uREAD))!=0 && (sym->usage & uNATIVE)==0)