aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-30 21:01:59 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-30 21:01:59 -0700
commitb6291927ffb898e37fd482b08669b3577e4d669a (patch)
tree220e6576fa8a9327a72e78e67fe57c09f6881257 /sys
parentca19f6fe479d739e84595fd4a034a8dd0484f2df (diff)
encountered bug due to lack of formalized incomplete types. on the next todo
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: