Add consistency checking for symbol flags

while also adding some consistency.
All listings now list . (dot) as defined so they need updating.
This commit is contained in:
Olaf Seibert
2021-05-28 22:11:34 +02:00
parent 7bbcbba5f5
commit 0ab2a4fa16
52 changed files with 235 additions and 128 deletions

View File

@@ -282,25 +282,25 @@ EX_TREE *evaluate(
/* Change some symbols to "undefined" */
if (flags & EVALUATE_DEFINEDNESS) {
int change = 0;
int is_undefined = 0;
/* I'd prefer this behavior, but MACRO.SAV is a bit too primitive. */
#if 0
/* A temporary symbol defined later is "undefined." */
if (!(sym->flags & PERMANENT) && sym->stmtno > stmtno)
change = 1;
is_undefined = 1;
#endif
/* A global symbol with no assignment is "undefined." */
/* Go figure. */
if ((sym->flags & (SYMBOLFLAG_GLOBAL | SYMBOLFLAG_DEFINITION)) == SYMBOLFLAG_GLOBAL)
change = 1;
if (SYM_IS_IMPORTED(sym))
is_undefined = 1;
/* A symbol marked as undefined is undefined */
if (sym->flags & SYMBOLFLAG_UNDEFINED)
change = 1;
is_undefined = 1;
if (change) {
if (is_undefined) {
res = new_temp_sym(tp->data.symbol->label, tp->data.symbol->section,
tp->data.symbol->value);
res->type = EX_UNDEFINED_SYM;
@@ -310,7 +310,7 @@ EX_TREE *evaluate(
/* Turn defined absolute symbol to a literal */
if (!(sym->section->flags & PSECT_REL)
&& (sym->flags & (SYMBOLFLAG_GLOBAL | SYMBOLFLAG_DEFINITION)) != SYMBOLFLAG_GLOBAL
&& !SYM_IS_IMPORTED(sym)
&& sym->section->type != SECTION_REGISTER) {
res = new_ex_lit(sym->value);
break;