ref: d48fb010d5772ec6a3c9620a5c763f6d3e36de84
parent: 5654476dce2255a26d4082d273fa4b654ae2513a
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jan 8 07:48:03 EST 2016
Convert negation() to use the new fields in type
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -551,16 +551,13 @@
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 *