scc

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

commit 48c5ae1798901462bcc7dab2413384636171330e
parent 8a56eecddd07a2a002a64bc3fcab3511e793abfe
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Tue, 19 Apr 2016 04:41:55 +0200

[cc2] Put type constant in a different enum

This is the last step to clean the main enum of cc2.h.
Enum op has now only constant related to ops used in nodes.

Diffstat:
Mcc2/cc2.h | 17++++++++---------
Mcc2/code.c | 4++--
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -20,10 +20,12 @@ enum sclass { SPRIV = 'Y', SLOCAL = 'T', SMEMB = 'M', + SCONST = '#', + STRING = '"', + SNONE = 0 }; -enum op { - /* types */ +enum types { ELLIPSIS = 'E', INT8 = 'C', INT16 = 'I', @@ -42,12 +44,11 @@ enum op { FLOAT = 'J', DOUBLE = 'D', LDOUBLE = 'H', - VOID = '0', - ONAME = '"', + VOID = '0' +}; + +enum op { /* kind of operand */ - NONE = 0, - CONST = '#', - STRING = '"', /* operands */ OMEM = 'M', OTMP = 'T', @@ -100,8 +101,6 @@ enum op { ODEFAULT = 'f', OTABLE = 't', OSWITCH = 's', - OEPARS = '\\', - OSTMT = '\t' }; enum nerrors { diff --git a/cc2/code.c b/cc2/code.c @@ -22,7 +22,7 @@ nextpc(void) } new->prev = pc; - new->to.kind = new->from2.kind = new->from1.kind = NONE; + new->to.kind = new->from2.kind = new->from1.kind = SNONE; pc = new; } @@ -33,7 +33,7 @@ addr(Node *np, Addr *addr) case SREG: addr->u.reg = np->u.reg; break; - case CONST: + case SCONST: abort(); break; case SLABEL: