Commit 7dcdbecb by Jim Wilson

(macroexpand): Don't output another error message if have

already output error message returned from macarg.

From-SVN: r2132
parent c47851dd
...@@ -6919,24 +6919,31 @@ macroexpand (hp, op) ...@@ -6919,24 +6919,31 @@ macroexpand (hp, op)
i = 0; i = 0;
} }
/* Don't output an error message if we have already output one for
a parse error above. */
rest_zero = 0; rest_zero = 0;
if (nargs == 0 && i > 0) if (nargs == 0 && i > 0) {
error ("arguments given to macro `%s'", hp->name); if (! parse_error)
else if (i < nargs) { error ("arguments given to macro `%s'", hp->name);
} else if (i < nargs) {
/* traditional C allows foo() if foo wants one argument. */ /* traditional C allows foo() if foo wants one argument. */
if (nargs == 1 && i == 0 && traditional) if (nargs == 1 && i == 0 && traditional)
; ;
/* the rest args token is allowed to absorb 0 tokens */ /* the rest args token is allowed to absorb 0 tokens */
else if (i == nargs - 1 && defn->rest_args) else if (i == nargs - 1 && defn->rest_args)
rest_zero = 1; rest_zero = 1;
else if (parse_error)
;
else if (i == 0) else if (i == 0)
error ("macro `%s' used without args", hp->name); error ("macro `%s' used without args", hp->name);
else if (i == 1) else if (i == 1)
error ("macro `%s' used with just one arg", hp->name); error ("macro `%s' used with just one arg", hp->name);
else else
error ("macro `%s' used with only %d args", hp->name, i); error ("macro `%s' used with only %d args", hp->name, i);
} else if (i > nargs) } else if (i > nargs) {
error ("macro `%s' used with too many (%d) args", hp->name, i); if (! parse_error)
error ("macro `%s' used with too many (%d) args", hp->name, i);
}
/* Swallow the closeparen. */ /* Swallow the closeparen. */
++instack[indepth].bufp; ++instack[indepth].bufp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment