ref: 15accc917305a32e269f8f3063108e9115d44d3d
parent: 986532bfe53fc9b4f4bce07d94039cbebffcdb61
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Aug 13 15:57:32 EDT 2015
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() .
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -267,6 +267,10 @@
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 @@
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));