scc

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

commit ad3115bad7ad1fff10fa676c55c1c78645e5f5a1
parent 6234ca1a96d4ff39e0e236337008886684af6237
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  7 Jan 2016 22:41:43 +0100

Convert incdec() to use new fields in Type

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

diff --git a/cc1/expr.c b/cc1/expr.c @@ -513,17 +513,14 @@ incdec(Node *np, char op) chklvalue(np); - switch (BTYPE(np)) { - case PTR: - if (!tp->defined) - error("invalid use of undefined type"); - inc = sizeofnode(tp->type); - break; - case INT: - case FLOAT: + if (!tp->defined) { + errorp("invalid use of undefined type"); + return np; + } else if (tp->arith) { inc = constnode(one); - break; - default: + } else if (tp->op == PTR) { + inc = sizeofnode(tp->type); + } else { errorp("wrong type argument to increment or decrement"); return np; }