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);
}
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 */
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);
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");
} 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 {
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;
}
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;
+ }
}
}
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;
pl = tp->tp_proto;
opl = otp->tp_proto;
+ if (pl == opl) return;
if (pl && opl) {
/* both have prototypes */
while (pl && opl) {