aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/cmd/cc/ast.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/cmd/cc/ast.c b/sys/cmd/cc/ast.c
index 14eddb9..4330bcc 100644
--- a/sys/cmd/cc/ast.c
+++ b/sys/cmd/cc/ast.c
@@ -1670,6 +1670,8 @@ spec(Parser *p, Lexer *lx, uint64 *spec)
goto Bad;
}
+ /* NOTE: This offset is needed to correctly obtain Tstruct */
+ n++;
name = nil;
tag = 0;
if (t.kind == Aident) {
@@ -1677,9 +1679,10 @@ spec(Parser *p, Lexer *lx, uint64 *spec)
t = advance(p, lx);
}
if (t.kind == Albrace) {
+ /* TODO: we need check if the name exists. */
t = advance(p, lx);
/* NOTE: This depends on the enum order. KEEP IN SYNC */
- tag = aggrfunc[i](p, lx, name, 1 << (n+1));
+ tag = aggrfunc[i](p, lx, name, Bit(n));
if (t = peek(p, 0), nomatch(t, Arbrace)) {
errorat(t.pos, "invalid token %s in aggregate/enum declaration", tokens[t.kind]);
goto Bad;
@@ -1687,11 +1690,10 @@ spec(Parser *p, Lexer *lx, uint64 *spec)
/* high bits encode the type index */
s |= (uint64)tag << 32;
}
+ /* TODO: if name does not exist, enter in an incomplete type! */
if (name)
declaretag(p, tag, name);
- /* NOTE: This offset is needed to correctly obtain Tstruct */
- n++;
break;
default: