Don't remove symbols or otherwise simplify expressions while assembly is
still in progress. There may be information that is needed, and when assembly is done it is still time to do so. (Needs more work). Better expression checks for fragments. Stuff that was detected by the linker before is now handled by the assembler. git-svn-id: svn://svn.cc65.org/cc65/trunk@2700 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -58,7 +58,8 @@ void DoEnum (void)
|
||||
/* Handle the .ENUM command */
|
||||
{
|
||||
/* Start at zero */
|
||||
ExprNode* NextExpr = GenLiteralExpr (0);
|
||||
long Offs = 0;
|
||||
ExprNode* BaseExpr = GenLiteralExpr (0);
|
||||
|
||||
/* Check for a name */
|
||||
int Anon = (Tok != TOK_IDENT);
|
||||
@@ -104,25 +105,27 @@ void DoEnum (void)
|
||||
/* Skip the equal sign */
|
||||
NextTok ();
|
||||
|
||||
/* Delete the old next expression */
|
||||
FreeExpr (NextExpr);
|
||||
|
||||
/* Read the new one */
|
||||
/* Read the new expression */
|
||||
EnumExpr = Expression ();
|
||||
|
||||
/* Reset the base expression and the offset */
|
||||
FreeExpr (BaseExpr);
|
||||
BaseExpr = CloneExpr (EnumExpr);
|
||||
Offs = 0;
|
||||
|
||||
} else {
|
||||
|
||||
EnumExpr = NextExpr;
|
||||
/* No assignment, use last value + 1 */
|
||||
EnumExpr = GenAddExpr (CloneExpr (BaseExpr), GenLiteralExpr (Offs));
|
||||
|
||||
}
|
||||
|
||||
/* Generate the next expression from the current one */
|
||||
NextExpr = GenAddExpr (CloneExpr (EnumExpr), GenLiteralExpr (1));
|
||||
NextExpr = SimplifyExpr (NextExpr);
|
||||
|
||||
/* Assign the value to the enum member */
|
||||
SymDef (Sym, EnumExpr, ADDR_SIZE_DEFAULT, SF_NONE);
|
||||
|
||||
/* Increment the offset for the next member */
|
||||
++Offs;
|
||||
|
||||
/* Expect end of line */
|
||||
ConsumeSep ();
|
||||
}
|
||||
@@ -136,8 +139,8 @@ void DoEnum (void)
|
||||
/* End of enum definition */
|
||||
Consume (TOK_ENDENUM, "`.ENDENUM' expected");
|
||||
|
||||
/* Free the last (unused) enum expression */
|
||||
FreeExpr (NextExpr);
|
||||
/* Free the base expression */
|
||||
FreeExpr (BaseExpr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user