scc

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

commit 1f26fd0dd93bed2e76b19b73f40c59bae22be15c
parent 7de77b9d418a975b358d701e26452c80819d6042
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 10 Aug 2014 23:13:17 +0200

Add division operator in cc2

Diffstat:
Mcc2/cc2.h | 1+
Mcc2/cgen.c | 4++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -70,6 +70,7 @@ enum nerrors { #define OASSIG ':' #define OINC ';' #define OMOD '%' +#define ODIV '/' extern void error(unsigned nerror, ...); extern void genaddable(Node *list[]); diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -125,7 +125,7 @@ xcgen(Node *np) switch (np->op) { case OINC: - case OADD: case OASSIG: case OMOD: + case OADD: case OASSIG: case OMOD: case ODIV: break; default: abort(); @@ -191,7 +191,7 @@ xaddable(Node *np) np->addable = 20; break; case OINC: - case OASSIG: case OADD: case OSUB: case OMOD: + case OASSIG: case OADD: case OSUB: case OMOD: case ODIV: xaddable(lp); xaddable(rp); break;