From: Jim Wilson Date: Wed, 16 Sep 1992 01:10:26 +0000 (-0700) Subject: (macroexpand): Don't output another error message if have X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dcdbecbbc6e93a0e764b32c22046805dc6b7f64;p=gcc.git (macroexpand): Don't output another error message if have already output error message returned from macarg. From-SVN: r2132 --- diff --git a/gcc/cccp.c b/gcc/cccp.c index 1c816a3b027..c22bddc72d1 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;