scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 4c8cd1d527ce2e8023299b091af90a824b7c1532
parent 91886b417645874398263b84f186d8bffe40e805
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  8 Aug 2014 16:39:58 +0200

Use shorter names for type of storage

These names are shorter but have the same meaning that the longers,
so they are better.

Diffstat:
Mcc2/cc2.h | 10+++++-----
Mcc2/cgen.c | 8++++----
Mcc2/parser.c | 10+++++-----
3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -46,12 +46,12 @@ enum nerrors { ENUMERR }; -#define FUNCTION 0 -#define VARIABLE 1 +#define FUN 0 +#define VAR 1 #define AUTO 'A' -#define REGISTER 'R' -#define STATIC 'T' -#define PARAMETER 'P' +#define REG 'R' +#define MEM 'T' +#define PAR 'P' #define CONST '#' #define LABEL 'L' #define OADD '+' diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -11,7 +11,7 @@ static void emit(char what, void *data) { switch (what) { - case FUNCTION: + case FUN: printf("%s:\n", data); break; default: @@ -23,7 +23,7 @@ emit(char what, void *data) void cgen(Symbol *sym, Node *list[]) { - emit(FUNCTION, sym->u.f.name); + emit(FUN, sym->u.f.name); } /* @@ -49,10 +49,10 @@ xaddable(Node *np) case AUTO: np->addable = 11; break; - case REGISTER: + case REG: np->addable = 13; break; - case STATIC: + case MEM: np->addable = 12; break; case CONST: diff --git a/cc2/parser.c b/cc2/parser.c @@ -99,15 +99,15 @@ variable(char *token) break; case 'R': sym = local(token); - op = REGISTER; + op = REG; break; case 'T': sym = (funbody) ? local(token) : global(token); - op = STATIC; + op = MEM; break; case 'G': sym = global(token); - op = STATIC; + op = MEM; public = 1; break; } @@ -208,7 +208,7 @@ declaration(char *token) case 'G': case 'R': case 'T': break; } - sym->type = VARIABLE; + sym->type = VAR; sym->u.v.storage = class; sym->u.v.type = gettype(strtok(NULL, "\t")); } @@ -230,7 +230,7 @@ function(char *token) curfun = global(token); if ((token = strtok(NULL, "\t")) == NULL) error(ESYNTAX); - curfun->type = FUNCTION; + curfun->type = FUN; curfun->u.f.name = xstrdup(token); listp = listexp; newp = nodepool;