shithub: scc

Download patch

ref: 4428ef865b3be5188fdf0c986ef5a0e114230484
parent: 3f7cefe8bfab6f9407dbaa61c15fce8bb70d0e64
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jan 27 06:13:49 EST 2017

[cc1] Remove bits from old 8 bit version

At the beginning the code was written to be 8 bit friendly
and it meant that a lot of variables were char instead of int,
but it doesn't make sense anymore.

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -210,7 +210,7 @@
 }
 
 static Node *
-integerop(char op, Node *lp, Node *rp)
+integerop(int op, Node *lp, Node *rp)
 {
 	if (!(lp->type->prop & TINTEGER) || !(rp->type->prop & TINTEGER))
 		error("operator requires integer operands");
@@ -219,7 +219,7 @@
 }
 
 static Node *
-integeruop(char op, Node *np)
+integeruop(int op, Node *np)
 {
 	if (!(np->type->prop & TINTEGER))
 		error("unary operator requires integer operand");
@@ -230,7 +230,7 @@
 }
 
 static Node *
-numericaluop(char op, Node *np)
+numericaluop(int op, Node *np)
 {
 	if (!(np->type->prop & TARITH))
 		error("unary operator requires numerical operand");
@@ -292,7 +292,7 @@
 }
 
 static Node *
-parithmetic(char op, Node *lp, Node *rp)
+parithmetic(int op, Node *lp, Node *rp)
 {
 	Type *tp;
 	Node *size, *np;
@@ -333,7 +333,7 @@
 }
 
 static Node *
-arithmetic(char op, Node *lp, Node *rp)
+arithmetic(int op, Node *lp, Node *rp)
 {
 	Type *ltp = lp->type, *rtp = rp->type;
 
@@ -355,7 +355,7 @@
 }
 
 static Node *
-pcompare(char op, Node *lp, Node *rp)
+pcompare(int op, Node *lp, Node *rp)
 {
 	Node *np;
 	int err = 0;
@@ -379,7 +379,7 @@
 }
 
 static Node *
-compare(char op, Node *lp, Node *rp)
+compare(int op, Node *lp, Node *rp)
 {
 	Type *ltp, *rtp;
 
@@ -471,7 +471,7 @@
 }
 
 static Node *
-logic(char op, Node *lp, Node *rp)
+logic(int op, Node *lp, Node *rp)
 {
 	lp = exp2cond(lp, 0);
 	rp = exp2cond(rp, 0);
@@ -511,7 +511,7 @@
 }
 
 static Node *
-content(char op, Node *np)
+content(int op, Node *np)
 {
 	if (BTYPE(np) != PTR) {
 		errorp("invalid argument of memory indirection");
@@ -545,7 +545,7 @@
 }
 
 static Node *
-assignop(char op, Node *lp, Node *rp)
+assignop(int op, Node *lp, Node *rp)
 {
 	if ((rp = convert(rp, lp->type, 0)) == NULL) {
 		errorp("incompatible types when assigning");
@@ -556,7 +556,7 @@
 }
 
 static Node *
-incdec(Node *np, char op)
+incdec(Node *np, int op)
 {
 	Type *tp = np->type;
 	Node *inc;
@@ -581,7 +581,7 @@
 }
 
 static Node *
-address(char op, Node *np)
+address(int op, Node *np)
 {
 	Node *new;
 
@@ -613,7 +613,7 @@
 }
 
 static Node *
-negation(char op, Node *np)
+negation(int op, Node *np)
 {
 	if (!(np->type->prop & TARITH) && np->type->op != PTR) {
 		errorp("invalid argument of unary '!'");
@@ -838,9 +838,9 @@
 static Node *
 unary(int needdecay)
 {
-	Node *(*fun)(char, Node *), *np;
+	Node *(*fun)(int, Node *), *np;
 	Symbol *sym;
-	char op;
+	int op;
 	Type *tp;
 	int paren;
 
@@ -943,8 +943,8 @@
 static Node *
 mul(void)
 {
-	Node *np, *(*fun)(char, Node *, Node *);
-	char op;
+	Node *np, *(*fun)(int, Node *, Node *);
+	int op;
 
 	np = cast(1);
 	for (;;) {
@@ -962,7 +962,7 @@
 static Node *
 add(void)
 {
-	char op;
+	int op;
 	Node *np;
 
 	np = mul();
@@ -980,7 +980,7 @@
 static Node *
 shift(void)
 {
-	char op;
+	int op;
 	Node *np;
 
 	np = add();
@@ -998,7 +998,7 @@
 static Node *
 relational(void)
 {
-	char op;
+	int op;
 	Node *np;
 
 	np = shift();
@@ -1018,7 +1018,7 @@
 static Node *
 eq(void)
 {
-	char op;
+	int op;
 	Node *np;
 
 	np = relational();
@@ -1110,8 +1110,8 @@
 Node *
 assign(void)
 {
-	Node *np, *(*fun)(char , Node *, Node *);
-	char op;
+	Node *np, *(*fun)(int , Node *, Node *);
+	int op;
 
 	np = ternary();
 	for (;;) {