[hackers] [scc] Convert negation() to use the new fields in type || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 8 Jan 2016 13:14:01 +0100 (CET)

commit d48fb010d5772ec6a3c9620a5c763f6d3e36de84
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Jan 8 12:48:03 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jan 8 12:48:03 2016 +0100

    Convert negation() to use the new fields in type

diff --git a/cc1/expr.c b/cc1/expr.c
index 12b2ff5..8e2df3c 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -551,16 +551,13 @@ address(char op, Node *np)
 static Node *
 negation(char op, Node *np)
 {
- switch (BTYPE(np)) {
- case FTN:
- case ARY:
- case INT:
- case FLOAT:
- case PTR:
- return exp2cond(np, 1);
- default:
- error("invalid argument of unary '!'");
+ np = decay(np);
+ if (!np->type->arith && np->type->op != PTR) {
+ errorp("invalid argument of unary '!'");
+ freetree(np);
+ return constnode(zero);
         }
+ return exp2cond(np, 1);
 }
 
 static Symbol *
Received on Fri Jan 08 2016 - 13:14:01 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 08 2016 - 13:25:19 CET