[hackers] [scc] Convert incdec() to use new fields in Type || Roberto E. Vargas Caballero

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

commit ad3115bad7ad1fff10fa676c55c1c78645e5f5a1
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 7 22:41:43 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jan 8 10:49:29 2016 +0100

    Convert incdec() to use new fields in Type

diff --git a/cc1/expr.c b/cc1/expr.c
index 25cecaf..dc59ea1 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -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;
         }
Received on Fri Jan 08 2016 - 13:13:59 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 08 2016 - 13:24:53 CET