commit 15accc917305a32e269f8f3063108e9115d44d3d
parent 986532bfe53fc9b4f4bce07d94039cbebffcdb61
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 13 Aug 2015 19:57:32 +0200
decay pointers and functions in eval()
This is mainly done for function calls, where
pointers are passed. We have to found a better
way to do this, because there are too much
calls to decay() .
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/cc1/expr.c b/cc1/expr.c
@@ -267,6 +267,10 @@ chklvalue(Node *np, Type *tp)
error("invalid use of void expression");
}
+/* TODO: put decay() call in a better place, because at this
+ moment we call dozens of calls in all the code */
+static Node *decay(Node *np);
+
Node *
eval(Node *np)
{
@@ -274,6 +278,12 @@ eval(Node *np)
if (!np)
return NULL;
+
+ switch (BTYPE(np)) {
+ case ARY:
+ case FTN:
+ np = decay(np);
+ }
if (np->op != OAND && np->op != OOR)
return np;
p = node(OCOLON, inttype, constnode(one), constnode(zero));