commit ad3115bad7ad1fff10fa676c55c1c78645e5f5a1
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Jan 7 22:41:43 2016 +0100
Commit:     Roberto E. Vargas Caballero <[email protected]>
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
@@ -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;
        }

Reply via email to