[hackers] [scc] Convert compare() to use the new fileds in Type || Roberto E. Vargas Caballero
commit 2fe852042893ad264f303ed805ae09be383f5dd7
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 7 21:32:44 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jan 8 10:49:29 2016 +0100
Convert compare() to use the new fileds in Type
diff --git a/cc1/expr.c b/cc1/expr.c
index 5251fd4..8b7fa6e 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -357,31 +357,24 @@ pcompare(char op, Node *lp, Node *rp)
static Node *
compare(char op, Node *lp, Node *rp)
{
+ Type *ltp, *rtp;
+
lp = decay(lp);
rp = decay(rp);
+ ltp = lp->type;
+ rtp = rtp->type;
- switch (BTYPE(lp)) {
- case INT:
- case FLOAT:
- switch (BTYPE(rp)) {
- case INT:
- case FLOAT:
- arithconv(&lp, &rp);
- break;
- case PTR:
- return pcompare(op, rp, lp);
- default:
- goto nocompat;
- }
- break;
- case PTR:
- return pcompare(op, lp, rp);
- default:
- nocompat:
+ if (ltp->op == PTR || rtp->op == PTR) {
+ return pcompare(op, rp, lp);
+ } else if (ltp->arith && rtp->arith) {
+ arithconv(&lp, &rp);
+ return simplify(op, inttype, lp, rp);
+ } else {
errorp("incompatibles type in comparision");
+ freetree(lp);
+ freetree(rp);
+ return constnode(zero);
}
-
- return simplify(op, inttype, lp, rp);
}
int
Received on Fri Jan 08 2016 - 13:13:58 CET
This archive was generated by hypermail 2.3.0
: Fri Jan 08 2016 - 13:24:43 CET