scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit e06b6e3d1bf6342fdcd2481868d1d93cbb9a5028
parent 4c4b5df2ff7447e0969bc39e80da24c7adc61cb3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 13 Aug 2015 07:44:32 +0200

Better errors in arguments()

Diffstat:
Mcc1/expr.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -763,16 +763,22 @@ arguments(Node *np) if ((arg = eval(assign())) == NULL) unexpected(); if ((arg = convert(arg, *targs++, 0)) == NULL) - error("bad type"); + goto bad_type; par = node(OPAR, arg->type, par, arg); } while (--n && accept(',')); } if (n > 0) - error("insuficient number of parameters..."); + error("too few arguments in function call"); + if (yytoken == ',') + error("too many arguments in function call"); expect(')'); return node(OCALL, np->type->type, np, par); + +bad_type: + error("incompatible type for argument %d in function call", + tp->n.elem - n + 1); } static Node *