More work on .sizeof

git-svn-id: svn://svn.cc65.org/cc65/trunk@2702 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-12-02 22:09:45 +00:00
parent 3a7c054f6b
commit 1a9a5f2687
8 changed files with 261 additions and 113 deletions

View File

@@ -121,10 +121,10 @@ static long DoStructInternal (long Offs, unsigned Type)
while (Tok != TOK_ENDSTRUCT && Tok != TOK_ENDUNION && Tok != TOK_EOF) {
long MemberSize;
SymEntry* Sym;
SymTable* Struct;
/* The format is "[identifier] storage-allocator [, multiplicator]" */
SymEntry* Sym = 0;
if (Tok == TOK_IDENT) {
/* We have an identifier, generate a symbol */
Sym = SymFind (CurrentScope, SVal, SYM_ALLOC_NEW);
@@ -168,7 +168,7 @@ static long DoStructInternal (long Offs, unsigned Type)
case TOK_TAG:
NextTok ();
Struct = ParseScopedSymTable (SYM_FIND_EXISTING);
Struct = ParseScopedSymTable ();
if (Struct == 0) {
Error ("Unknown struct/union");
} else if (GetSymTabType (Struct) != ST_STRUCT) {
@@ -200,6 +200,11 @@ static long DoStructInternal (long Offs, unsigned Type)
}
}
/* Assign the size to the member if it has a name */
if (Sym) {
DefSizeOfSymbol (Sym, MemberSize);
}
/* Next member */
if (Type == STRUCT) {
/* Struct */