]> Shamusworld >> Repos - rmac/blobdiff - expr.c
Fixed a nasty bug that dropped symbols that shouldn't have been.
[rmac] / expr.c
diff --git a/expr.c b/expr.c
index 9eeb6e7662c28f2d4d2538eb014ad0b4c3048700..deeea40a893300bba19bf3b587b18b78ad47a072 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -360,7 +360,7 @@ int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
                        j = (*p == '.' ? curenv : 0);
                        symbol = lookup(p, LABEL, j);
 #if 0
-printf("eval: Looking up symbol [=%08X]\n", symbol);
+printf("eval: Looking up symbol (%s) [=%08X]\n", p, symbol);
 if (symbol)
        printf("      attr=%04X, attre=%08X, val=%i, name=%s\n", symbol->sattr, symbol->sattre, symbol->svalue, symbol->sname);
 #endif
@@ -370,8 +370,11 @@ if (symbol)
 
                        symbol->sattr |= REFERENCED;
 
-                       // Check for undefined register equates
-                       if (symbol->sattre & UNDEF_EQUR)
+                       // Check for undefined register equates, but only if it's not part
+                       // of a #<SYMBOL> construct, as it could be that the label that's
+                       // been undefined may later be used as an address label--which
+                       // means it will be fixed up later, and thus, not an error.
+                       if ((symbol->sattre & UNDEF_EQUR) && !riscImmTokenSeen)
                        {
                                errors("undefined register equate '%s'", symbol->sname);
 //if we return right away, it returns some spurious errors...
@@ -413,7 +416,6 @@ thrown away right here. What the hell is it for?
 */
                        if (symbol->sattre & EQUATEDREG) 
                                *a_value &= 0x1F;
-
                        *a_attr = (WORD)(symbol->sattr & ~GLOBAL);
 
                        if ((symbol->sattr & (GLOBAL | DEFINED)) == GLOBAL && a_esym != NULL)
@@ -423,7 +425,7 @@ thrown away right here. What the hell is it for?
                }
                else
                {
-                       // Unknown type here... Alert the user!
+                       // Unknown type here... Alert the user!,
                        error("undefined RISC register in expression");
                        // Prevent spurious error reporting...
                        tok++;