shithub: scc

Download patch

ref: 67d7bcb3689d2a33d7e2c0cdda9332f74750d8cd
parent: 78edebdf4d11d94de525b8e566a322b4ff3af0f5
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon May 25 12:27:55 EDT 2015

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.

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -493,8 +493,16 @@
 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;