commit 53e6393295871b4682bf54374bc76cb0c35c42a6
parent 8d2d674466c14738418fb6579126569f53d6f86a
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sun, 2 Aug 2015 20:16:18 -0400
avoid name conflicts in enums
Diffstat:
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/lisc/lisc.h b/lisc/lisc.h
@@ -105,12 +105,6 @@ enum {
};
enum {
- CXXX,
- CWord,
- CLong,
-};
-
-enum {
JXXX,
JRet,
JJmp,
@@ -160,8 +154,12 @@ struct Blk {
};
struct Sym {
+ enum {
+ SUndef,
+ SWord,
+ SLong,
+ } type;
char name[NString];
- int class;
uint ndef, nuse;
uint cost;
uint spill;
diff --git a/lisc/parse.c b/lisc/parse.c
@@ -404,10 +404,10 @@ parseline(PState ps)
expect(TEq);
switch (next()) {
case TW:
- sym[r.val].class = CWord;
+ sym[r.val].type = SWord;
break;
case TL:
- sym[r.val].class = CLong;
+ sym[r.val].type = SLong;
break;
default:
err("class expected after =");
@@ -521,16 +521,16 @@ parsefn(FILE *f)
static char *
printref(Ref r, Fn *fn, FILE *f)
{
- static char *ctoa[] = {
- [CXXX] = "?",
- [CWord] = "w",
- [CLong] = "l",
+ static char *ttoa[] = {
+ [SUndef] = "?",
+ [SWord] = "w",
+ [SLong] = "l",
};
switch (r.type) {
case RSym:
fprintf(f, "%%%s", fn->sym[r.val].name);
- return ctoa[fn->sym[r.val].class];
+ return ttoa[fn->sym[r.val].type];
case RCons:
switch (fn->cons[r.val].type) {
case CAddr: