fixed bugs with storage-class and void in prototype

This commit is contained in:
eck 1990-12-17 13:08:05 +00:00
parent 79444acd83
commit ccc5f10fca

View file

@ -77,11 +77,23 @@ add_proto(pl, ds, dc, lvl)
if (type->tp_fund != VOID)
error("unknown %s-type", symbol2str(type->tp_fund));
else {
if (idf != (struct idf *)0)
if (idf != (struct idf *)0
|| ds->ds_sc_given
|| ds->ds_typequal) {
error("illegal use of void in argument list");
else {
pl->pl_flag |= PL_VOID;
pl->pl_flag |= PL_ERRGIVEN;
}
/* set PL_VOID anyway */
pl->pl_flag |= PL_VOID;
}
}
if (ds->ds_sc_given && ds->ds_sc != REGISTER) {
if (!(pl->pl_flag & PL_ERRGIVEN)) {
if (ds->ds_sc != AUTO) {
error("illegal storage class in parameter declaration");
} else {
warning("illegal storage class in parameter declaration");
}
}
}
@ -230,11 +242,6 @@ declare_protos(dc)
continue;
}
/* Postponed storage class checking.
*/
if (def->df_sc == 0)
error("illegal storage class in parameter declaration");
def->df_level = L_FORMAL2;
stack_idf(pl->pl_idf, stl);
pl = pl->next;