shithub: scc

Download patch

ref: e06b6e3d1bf6342fdcd2481868d1d93cbb9a5028
parent: 4c4b5df2ff7447e0969bc39e80da24c7adc61cb3
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Aug 13 03:44:32 EDT 2015

Better errors in arguments()

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -763,16 +763,22 @@
 			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 *