[hackers] [scc] Better errors in arguments() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 13 Aug 2015 07:50:50 +0200 (CEST)

commit e06b6e3d1bf6342fdcd2481868d1d93cbb9a5028
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Aug 13 07:44:32 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Aug 13 07:44:32 2015 +0200

    Better errors in arguments()

diff --git a/cc1/expr.c b/cc1/expr.c
index 5e525af..a55af6d 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -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 *
Received on Thu Aug 13 2015 - 07:50:50 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 13 2015 - 08:00:16 CEST