scc

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

commit 0c094f48799666e4e0c82aed4fd817f69a3f3f6e
parent 11f2fad7a2d1dfb01db4048b86f48c9762909587
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  7 Jan 2016 19:21:56 +0100

Interchange integeruop() and numericaluop()

This change puts integeruop() after integerop(),  which
simplifies reading the code, because it puts together
related functions.

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

diff --git a/cc1/expr.c b/cc1/expr.c @@ -211,26 +211,26 @@ integerop(char op, Node *lp, Node *rp) } static Node * -numericaluop(char op, Node *np) +integeruop(char op, Node *np) { - if (!np->type->arith) - error("unary operator requires numerical operand"); + if (!np->type->integer) + error("unary operator requires integer operand"); np = promote(np); - if (op == ONEG && np->op == ONEG) + if (op == OCPL && np->op == OCPL) return np->left; - if (op == OADD) - return np; return simplify(op, np->type, np, NULL); } static Node * -integeruop(char op, Node *np) +numericaluop(char op, Node *np) { - if (!np->type->integer) - error("unary operator requires integer operand"); + if (!np->type->arith) + error("unary operator requires numerical operand"); np = promote(np); - if (op == OCPL && np->op == OCPL) + if (op == ONEG && np->op == ONEG) return np->left; + if (op == OADD) + return np; return simplify(op, np->type, np, NULL); }