From 3a7c054f6bbeaf80a461653cf5af442e5129ec2e Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 30 Nov 2003 22:54:13 +0000 Subject: [PATCH] Temp fix for address size detection of symbols git-svn-id: svn://svn.cc65.org/cc65/trunk@2701 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/symentry.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/ca65/symentry.c b/src/ca65/symentry.c index 257265101..ee137b9e9 100644 --- a/src/ca65/symentry.c +++ b/src/ca65/symentry.c @@ -46,6 +46,7 @@ #include "scanner.h" #include "segment.h" #include "spool.h" +#include "studyexpr.h" /* ### */ #include "symentry.h" #include "symtab.h" @@ -87,20 +88,6 @@ int IsLocalNameId (unsigned Name) -static unsigned SymAddrSize (const SymEntry* S) -/* Get the default address size for a symbol. */ -{ - /* Local symbols are always near (is this ok?) */ - if (IsLocalNameId (S->Name)) { - return ADDR_SIZE_ABS; - } - - /* Return the address size of the segment */ - return GetCurrentSegAddrSize (); -} - - - SymEntry* NewSymEntry (const char* Name) /* Allocate a symbol table entry, initialize and return it */ { @@ -220,20 +207,12 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags /* Map a default address size to a real value */ if (AddrSize == ADDR_SIZE_DEFAULT) { - long Val; - if (IsConstExpr (Expr, &Val)) { - if (IsByteRange (Val)) { - AddrSize = ADDR_SIZE_ZP; - } else if (IsWordRange (Val)) { - AddrSize = ADDR_SIZE_ABS; - } else if (IsFarRange (Val)) { - AddrSize = ADDR_SIZE_FAR; - } else { - AddrSize = ADDR_SIZE_LONG; - } - } else { - AddrSize = SymAddrSize (S); - } + /* ### Must go! Delay address size calculation until end of assembly! */ + ExprDesc ED; + ED_Init (&ED); + StudyExpr (Expr, &ED); + AddrSize = ED.AddrSize; + ED_Done (&ED); } /* Set the symbol value */ -- 2.39.5