Emit warnings for symbols that were used suboptimal because of forward

definitions. For example a zero page symbol that is used as absolute because
it was undefined when encountered.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3724 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2006-04-09 10:56:23 +00:00
parent 44405a0bb5
commit c13f40a9f1
6 changed files with 151 additions and 34 deletions

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2004 Ullrich von Bassewitz */
/* (C) 1998-2006 Ullrich von Bassewitz */
/* R<>merstra<72>e 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@@ -78,21 +78,27 @@
/* Structure of a symbol table entry */
typedef struct SymEntry SymEntry;
struct SymEntry {
SymEntry* Left; /* Lexically smaller entry */
SymEntry* Right; /* Lexically larger entry */
SymEntry* List; /* List of all entries */
SymEntry* Locals; /* Root of subtree for local symbols */
struct SymTable* SymTab; /* Table this symbol is in, 0 for locals */
FilePos Pos; /* File position for this symbol */
unsigned Flags; /* Symbol flags */
unsigned Index; /* Index of import/export entries */
struct ExprNode* Expr; /* Symbol expression */
Collection ExprRefs; /* Expressions using this symbol */
unsigned char ExportSize; /* Export address size */
unsigned char AddrSize; /* Address size of label */
unsigned char ConDesPrio[CD_TYPE_COUNT]; /* ConDes priorities... */
SymEntry* Left; /* Lexically smaller entry */
SymEntry* Right; /* Lexically larger entry */
SymEntry* List; /* List of all entries */
SymEntry* Locals; /* Root of subtree for local symbols */
struct SymTable* SymTab; /* Table this symbol is in, 0 for locals */
FilePos Pos; /* File position for this symbol */
FilePos* GuessedUse[1]; /* File position where symbol
* address size was guessed, and the
* smallest possible addressing was NOT
* used. Currently only for zero page
* addressing
*/
unsigned Flags; /* Symbol flags */
unsigned Index; /* Index of import/export entries */
struct ExprNode* Expr; /* Symbol expression */
Collection ExprRefs; /* Expressions using this symbol */
unsigned char ExportSize; /* Export address size */
unsigned char AddrSize; /* Address size of label */
unsigned char ConDesPrio[CD_TYPE_COUNT]; /* ConDes priorities... */
/* ...actually value+1 (used as flag) */
unsigned Name; /* Name index in global string pool */
unsigned Name; /* Name index in global string pool */
};
/* List of all symbol table entries */
@@ -166,6 +172,13 @@ void SymConDes (SymEntry* Sym, unsigned char AddrSize, unsigned Type, unsigned P
* mark the symbol as an export. Initializers may never be zero page symbols.
*/
void SymGuessedAddrSize (SymEntry* Sym, unsigned char AddrSize);
/* Mark the address size of the given symbol as guessed. The address size
* passed as argument is the one NOT used, because the actual address size
* wasn't known. Example: Zero page addressing was not used because symbol
* is undefined, and absolute addressing was available.
*/
void SymExportFromGlobal (SymEntry* S);
/* Called at the end of assembly. Converts a global symbol that is defined
* into an export.