commit 249af91ff9d9ffbd8962efcad999de442e609658
parent b698584443f17b8d0cfd88e0afe037ce351e0ee6
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Tue, 14 Feb 2017 13:10:02 -0500
minor cleanup in all.h
Diffstat:
3 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/all.h b/all.h
@@ -9,7 +9,6 @@
#define die(...) die_(__FILE__, __VA_ARGS__)
typedef unsigned int uint;
-typedef unsigned short ushort;
typedef unsigned long ulong;
typedef unsigned long long bits;
@@ -101,8 +100,8 @@ struct BSet {
};
struct Ref {
- uint32_t type:3;
- uint32_t val:29;
+ uint type:3;
+ uint val:29;
};
enum {
@@ -456,14 +455,13 @@ struct Typ {
int align;
size_t size;
int nunion;
-
struct Seg {
enum {
- Send,
- Spad,
- Sint,
- Sflt,
- Styp,
+ SEnd,
+ SPad,
+ SInt,
+ SFlt,
+ STyp,
} type;
uint len; /* index in typ[] for Styp */
} (*seg)[NSeg+1];
diff --git a/parse.c b/parse.c
@@ -872,17 +872,17 @@ parseseg(Seg *seg, Typ *ty, int t)
sz = 0;
al = ty->align;
while (t != Trbrace) {
- type = Sint;
+ type = SInt;
switch (t) {
default: err("invalid type member specifier");
- case Td: type = Sflt;
+ case Td: type = SFlt;
case Tl: s = 8; a = 3; break;
- case Ts: type = Sflt;
+ case Ts: type = SFlt;
case Tw: s = 4; a = 2; break;
case Th: s = 2; a = 1; break;
case Tb: s = 1; a = 0; break;
case Ttyp:
- type = Styp;
+ type = STyp;
ty1 = &typ[findtyp(ntyp-1)];
s = ty1->size;
a = ty1->align;
@@ -894,7 +894,7 @@ parseseg(Seg *seg, Typ *ty, int t)
a = s - a;
if (n < NSeg) {
/* padding segment */
- seg[n].type = Spad;
+ seg[n].type = SPad;
seg[n].len = a;
n++;
}
@@ -906,7 +906,7 @@ parseseg(Seg *seg, Typ *ty, int t)
} else
c = 1;
sz += a + c*s;
- if (type == Styp)
+ if (type == STyp)
s = ty1 - typ;
for (; c>0 && n<NSeg; c--, n++) {
seg[n].type = type;
@@ -918,7 +918,7 @@ parseseg(Seg *seg, Typ *ty, int t)
}
if (t != Trbrace)
err(", or } expected");
- seg[n].type = Send;
+ seg[n].type = SEnd;
a = 1 << al;
sz = (sz + a - 1) & -a;
if (sz >= ty->size)
diff --git a/sysv.c b/sysv.c
@@ -28,19 +28,19 @@ classify(AClass *a, Typ *t, int *pn, int *pe)
cls = &a->cls[*pe];
for (; *pn<8; s++) {
switch (seg[s].type) {
- case Send:
+ case SEnd:
goto Done;
- case Spad:
+ case SPad:
/* don't change anything */
break;
- case Sflt:
+ case SFlt:
if (*cls == Kx)
*cls = Kd;
break;
- case Sint:
+ case SInt:
*cls = Kl;
break;
- case Styp:
+ case STyp:
classify(a, &typ[seg[s].len], pn, pe);
continue;
}