various bug fixes & improvements
authoreck <none@none>
Fri, 6 Apr 1990 15:37:16 +0000 (15:37 +0000)
committereck <none@none>
Fri, 6 Apr 1990 15:37:16 +0000 (15:37 +0000)
lang/cem/cemcom.ansi/ch3.c
lang/cem/cemcom.ansi/ch3mon.c
lang/cem/cemcom.ansi/dumpidf.c
lang/cem/cemcom.ansi/idf.c
lang/cem/cemcom.ansi/proto.c

index 6803fc8..bfe03f1 100644 (file)
@@ -612,7 +612,7 @@ ch3asgn(expp, oper, expr)
                expr_error(exp, "operand of %s is read-only", oper_string);
        } else if (fund == STRUCT || fund == UNION) {
                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);
        }
 
index fc82a45..08a2fc4 100644 (file)
@@ -42,9 +42,8 @@ ch3mon(oper, expp)
                                    symbol2str((*expp)->ex_type->tp_fund));
                } else {
                        expr = *expp;
-                       if ((expr->ex_type->tp_fund == ARRAY
-                               && expr->ex_class != String)
-                           || expr->ex_type->tp_fund == FUNCTION)
+
+                       if (is_ld_cst(expr))
                                /* dereference in administration only */
                                expr->ex_type = expr->ex_type->tp_up;
                        else    /* runtime code */
index 9c55d20..fc5ee22 100644 (file)
@@ -255,7 +255,8 @@ dump_proto(pl)
                print("%d: %s", argcnt++,
                        pl->pl_flag & PL_FORMAL ?
                        (pl->pl_flag & PL_VOID ? "void" : "formal")
-                       : "ellipsis");
+                       : (pl->pl_flag & PL_ELLIPSIS
+                               ? "ellipsis" : "unknown" ));
                newline();
                if (type = pl->pl_type){
                        dump_type(type);
index f01832a..5d4b64a 100644 (file)
@@ -597,11 +597,10 @@ check_formals(idf, dc)
 
        if (du->du_proto) return;
 
-       if (!options['o'])
-               warning("'%s' old-fashioned function definition"
-                               , dc->dc_idf->id_text);
-
        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 (!(du->du_proto) && !(pl->pl_flag & PL_ERRGIVEN))
                        error("ellipsis terminator in previous declaration");
@@ -627,6 +626,10 @@ check_formals(idf, dc)
        } else {                        /* make a pseudo-prototype */
                register struct proto *lpl = new_proto();
 
+               if (!options['o'])
+                       warning("'%s' old-fashioned function definition"
+                                       , dc->dc_idf->id_text);
+
                while (fm) {
                        if (pl == 0) pl = lpl;
                        else {
@@ -642,7 +645,7 @@ check_formals(idf, dc)
                if (pl == 0) {          /* make func(void) */
                        pl = lpl;
                        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;
        }
index 41a7ef5..2f706a8 100644 (file)
@@ -79,7 +79,9 @@ add_proto(pl, ds, dc, lvl)
                else {
                        if (idf != (struct idf *)0)
                                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;
 
        while (tp->tp_fund != FUNCTION) {
+               if (tp->tp_fund != POINTER && tp->tp_fund != ARRAY) return;
                tp = tp->tp_up;
                otp = otp->tp_up;
                if (!tp) return;
@@ -287,6 +290,7 @@ update_proto(tp, otp)
 
        pl = tp->tp_proto;
        opl = otp->tp_proto;
+       if (pl == opl) return;
        if (pl && opl) {
                /* both have prototypes */
                while (pl && opl) {