scc

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

commit 03513bb49e57c85779f088666ae448f3932089ca
parent 60170fa8ff5a4d0ffc73cf069eb190ea99386cc0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  3 Apr 2014 21:41:21 +0200

Clean arithmetic() function

There were some comments and some small bugs in this function
,
as for example accept FTN types in this expressions.

Diffstat:
Mexpr.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/expr.c b/expr.c @@ -65,7 +65,7 @@ arithmetic(char op, Node *np1, Node *np2) case FLOAT: SWAP(np1, np2, naux); goto int_float; - case PTR: case FTN: case ARY: + case PTR: case ARY: SWAP(np1, np2, naux); SWAP(t1, t2, taux); goto pointer; @@ -80,7 +80,8 @@ arithmetic(char op, Node *np1, Node *np2) floatconv(&np1, &np2); break; case INT: -int_float: np2 = castcode(np2, np1->type); +int_float: + np2 = castcode(np2, np1->type); break; default: goto incorrect; @@ -107,7 +108,7 @@ pointer: return bincode(op, tp1, np1, np2); incorrect: - error("incorrect arithmetic operands"); /*TODO: print type names */ + error("incorrect arithmetic operands"); } static Node *