[hackers] [scc] Use BTYPE instead of np->type->op || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 24 Jul 2015 17:39:08 +0200 (CEST)

commit 73e8f02ee56e42272698ef92ec8b593cec130843
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Jul 24 14:10:55 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jul 24 14:10:55 2015 +0200

    Use BTYPE instead of np->type->op

diff --git a/cc1/cc1.h b/cc1/cc1.h
index d088a8f..59d828d 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -327,6 +327,7 @@ extern Node *constnode(Symbol *sym);
 extern Node *sizeofnode(Type *tp);
 extern void freetree(Node *np);
 extern Node *simplify(unsigned char, Type *tp, Node *lp, Node *rp);
+#define BTYPE(np) ((np)->type->op)
 
 /* expr.c */
 extern Node *expr(void), *negate(Node *np), *constexpr(void);
diff --git a/cc1/code.c b/cc1/code.c
index 05e329b..dd39f41 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -183,7 +183,7 @@ emitconst(Node *np)
         char *bp, c;
         Symbol *sym = np->sym;
 
- switch (np->type->op) {
+ switch (BTYPE(np)) {
         case INT:
                 printf("#%c%x", np->type->letter, sym->u.i);
                 break;
diff --git a/cc1/expr.c b/cc1/expr.c
index f582a33..2a7cfbc 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -6,8 +6,6 @@
 #include "../inc/cc.h"
 #include "cc1.h"
 
-#define BTYPE(np) ((np)->type->op)
-
 extern Symbol *zero, *one;
 
 Node *expr(void);
_AT_@ -377,7 +375,7 @@ iszero(Node *np)
 static Node *
 assignop(char op, Node *lp, Node *rp)
 {
- switch (rp->type->op) {
+ switch (BTYPE(rp)) {
         case FTN:
         case ARY:
                 rp = decay(rp);
diff --git a/cc1/stmt.c b/cc1/stmt.c
index e4b1cd9..cf6d106 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
_AT_@ -219,7 +219,7 @@ Switch(Symbol *lbreak, Symbol *lcont, Caselist *lswitch)
         expect(SWITCH);
         expect ('(');
         cond = expr();
- if (cond->type->op != INT)
+ if (BTYPE(cond) != INT)
                 error("incorrect type in switch statement");
         cond = convert(cond, inttype, 0);
         expect (')');
Received on Fri Jul 24 2015 - 17:39:08 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 24 2015 - 17:48:14 CEST