aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1992-09-15 18:10:26 -0700
committerJim Wilson <wilson@gcc.gnu.org>1992-09-15 18:10:26 -0700
commit7dcdbecbbc6e93a0e764b32c22046805dc6b7f64 (patch)
treea81c01d94aeb86e29e587fd91a9f42ca4b196365 /gcc
parentc47851ddce30de5239c96f1a2ce4466efefb6ea6 (diff)
downloadgcc-7dcdbecbbc6e93a0e764b32c22046805dc6b7f64.zip
gcc-7dcdbecbbc6e93a0e764b32c22046805dc6b7f64.tar.gz
gcc-7dcdbecbbc6e93a0e764b32c22046805dc6b7f64.tar.bz2
(macroexpand): Don't output another error message if have
already output error message returned from macarg. From-SVN: r2132
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 1c816a3..c22bddc 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -6919,24 +6919,31 @@ macroexpand (hp, op)
i = 0;
}
+ /* Don't output an error message if we have already output one for
+ a parse error above. */
rest_zero = 0;
- if (nargs == 0 && i > 0)
- error ("arguments given to macro `%s'", hp->name);
- else if (i < nargs) {
+ if (nargs == 0 && i > 0) {
+ if (! parse_error)
+ error ("arguments given to macro `%s'", hp->name);
+ } else if (i < nargs) {
/* traditional C allows foo() if foo wants one argument. */
if (nargs == 1 && i == 0 && traditional)
;
/* the rest args token is allowed to absorb 0 tokens */
else if (i == nargs - 1 && defn->rest_args)
rest_zero = 1;
+ else if (parse_error)
+ ;
else if (i == 0)
error ("macro `%s' used without args", hp->name);
else if (i == 1)
error ("macro `%s' used with just one arg", hp->name);
else
error ("macro `%s' used with only %d args", hp->name, i);
- } else if (i > nargs)
- error ("macro `%s' used with too many (%d) args", hp->name, i);
+ } else if (i > nargs) {
+ if (! parse_error)
+ error ("macro `%s' used with too many (%d) args", hp->name, i);
+ }
/* Swallow the closeparen. */
++instack[indepth].bufp;