scc

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

commit 67d7bcb3689d2a33d7e2c0cdda9332f74750d8cd
parent 78edebdf4d11d94de525b8e566a322b4ff3af0f5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 25 May 2015 16:27:55 +0200

Add check of type in function call

Function call is not implemented at this moment, but it is useful
if it can detect that the type of the node is not a callable
object.

Diffstat:
Mcc1/expr.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -493,8 +493,16 @@ static Node * arguments(Node *np) { Node *par; + Type *tp = np->type; - /* TODO: Check type of np */ + if (tp->op == PTR && tp->type->op == FTN) { + np = content(OPTR, np); + tp = np->type; + } + if (tp->op != FTN) + error("function or function pointer expected"); + /* TODO: implement function calls */ + abort(); expect('('); if (accept(')')) return np;