various bug fixes & improvements
This commit is contained in:
parent
6e685b9fcc
commit
aa4de95f26
5 changed files with 18 additions and 11 deletions
|
@ -612,7 +612,7 @@ ch3asgn(expp, oper, expr)
|
||||||
expr_error(exp, "operand of %s is read-only", oper_string);
|
expr_error(exp, "operand of %s is read-only", oper_string);
|
||||||
} else if (fund == STRUCT || fund == UNION) {
|
} else if (fund == STRUCT || fund == UNION) {
|
||||||
if (recurqual(exp->ex_type, TQ_CONST))
|
if (recurqual(exp->ex_type, TQ_CONST))
|
||||||
expr_error(expr,"operand of %s contains a const-qualified member",
|
expr_error(exp,"operand of %s contains a const-qualified member",
|
||||||
oper_string);
|
oper_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,8 @@ ch3mon(oper, expp)
|
||||||
symbol2str((*expp)->ex_type->tp_fund));
|
symbol2str((*expp)->ex_type->tp_fund));
|
||||||
} else {
|
} else {
|
||||||
expr = *expp;
|
expr = *expp;
|
||||||
if ((expr->ex_type->tp_fund == ARRAY
|
|
||||||
&& expr->ex_class != String)
|
if (is_ld_cst(expr))
|
||||||
|| expr->ex_type->tp_fund == FUNCTION)
|
|
||||||
/* dereference in administration only */
|
/* dereference in administration only */
|
||||||
expr->ex_type = expr->ex_type->tp_up;
|
expr->ex_type = expr->ex_type->tp_up;
|
||||||
else /* runtime code */
|
else /* runtime code */
|
||||||
|
|
|
@ -255,7 +255,8 @@ dump_proto(pl)
|
||||||
print("%d: %s", argcnt++,
|
print("%d: %s", argcnt++,
|
||||||
pl->pl_flag & PL_FORMAL ?
|
pl->pl_flag & PL_FORMAL ?
|
||||||
(pl->pl_flag & PL_VOID ? "void" : "formal")
|
(pl->pl_flag & PL_VOID ? "void" : "formal")
|
||||||
: "ellipsis");
|
: (pl->pl_flag & PL_ELLIPSIS
|
||||||
|
? "ellipsis" : "unknown" ));
|
||||||
newline();
|
newline();
|
||||||
if (type = pl->pl_type){
|
if (type = pl->pl_type){
|
||||||
dump_type(type);
|
dump_type(type);
|
||||||
|
|
|
@ -597,11 +597,10 @@ check_formals(idf, dc)
|
||||||
|
|
||||||
if (du->du_proto) return;
|
if (du->du_proto) return;
|
||||||
|
|
||||||
if (!options['o'])
|
|
||||||
warning("'%s' old-fashioned function definition"
|
|
||||||
, dc->dc_idf->id_text);
|
|
||||||
|
|
||||||
if (pl) {
|
if (pl) {
|
||||||
|
/* Don't give a warning about an old-style definition,
|
||||||
|
* since the arguments will be checked anyway.
|
||||||
|
*/
|
||||||
if (pl->pl_flag & PL_ELLIPSIS) {
|
if (pl->pl_flag & PL_ELLIPSIS) {
|
||||||
if (!(du->du_proto) && !(pl->pl_flag & PL_ERRGIVEN))
|
if (!(du->du_proto) && !(pl->pl_flag & PL_ERRGIVEN))
|
||||||
error("ellipsis terminator in previous declaration");
|
error("ellipsis terminator in previous declaration");
|
||||||
|
@ -627,6 +626,10 @@ check_formals(idf, dc)
|
||||||
} else { /* make a pseudo-prototype */
|
} else { /* make a pseudo-prototype */
|
||||||
register struct proto *lpl = new_proto();
|
register struct proto *lpl = new_proto();
|
||||||
|
|
||||||
|
if (!options['o'])
|
||||||
|
warning("'%s' old-fashioned function definition"
|
||||||
|
, dc->dc_idf->id_text);
|
||||||
|
|
||||||
while (fm) {
|
while (fm) {
|
||||||
if (pl == 0) pl = lpl;
|
if (pl == 0) pl = lpl;
|
||||||
else {
|
else {
|
||||||
|
@ -642,7 +645,7 @@ check_formals(idf, dc)
|
||||||
if (pl == 0) { /* make func(void) */
|
if (pl == 0) { /* make func(void) */
|
||||||
pl = lpl;
|
pl = lpl;
|
||||||
pl->pl_type = void_type;
|
pl->pl_type = void_type;
|
||||||
pl->pl_flag = PL_VOID;
|
pl->pl_flag = PL_FORMAL | PL_VOID;
|
||||||
}
|
}
|
||||||
idf->id_def->df_type->tp_pseudoproto = pl;
|
idf->id_def->df_type->tp_pseudoproto = pl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,9 @@ add_proto(pl, ds, dc, lvl)
|
||||||
else {
|
else {
|
||||||
if (idf != (struct idf *)0)
|
if (idf != (struct idf *)0)
|
||||||
error("illegal use of void in argument list");
|
error("illegal use of void in argument list");
|
||||||
else pl->pl_flag = PL_VOID;
|
else {
|
||||||
|
pl->pl_flag |= PL_VOID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +282,7 @@ update_proto(tp, otp)
|
||||||
if (!tp || !otp) return;
|
if (!tp || !otp) return;
|
||||||
|
|
||||||
while (tp->tp_fund != FUNCTION) {
|
while (tp->tp_fund != FUNCTION) {
|
||||||
|
if (tp->tp_fund != POINTER && tp->tp_fund != ARRAY) return;
|
||||||
tp = tp->tp_up;
|
tp = tp->tp_up;
|
||||||
otp = otp->tp_up;
|
otp = otp->tp_up;
|
||||||
if (!tp) return;
|
if (!tp) return;
|
||||||
|
@ -287,6 +290,7 @@ update_proto(tp, otp)
|
||||||
|
|
||||||
pl = tp->tp_proto;
|
pl = tp->tp_proto;
|
||||||
opl = otp->tp_proto;
|
opl = otp->tp_proto;
|
||||||
|
if (pl == opl) return;
|
||||||
if (pl && opl) {
|
if (pl && opl) {
|
||||||
/* both have prototypes */
|
/* both have prototypes */
|
||||||
while (pl && opl) {
|
while (pl && opl) {
|
||||||
|
|
Loading…
Reference in a new issue