]> git.sur5r.net Git - cc65/blobdiff - src/ca65/symentry.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / symentry.c
index aebab7416d1441cf177779f353d7d964fd04ed81..763820731c954d9d1d785877882256a1dd8df706 100644 (file)
@@ -87,7 +87,7 @@ SymEntry* NewSymEntry (const StrBuf* Name, unsigned Flags)
     S->Locals            = 0;
     S->Sym.Tab    = 0;
     S->LineInfos  = EmptyCollection;
-    GetFullLineInfo (&S->LineInfos);
+    GetFullLineInfo (&S->LineInfos, 1);
     for (I = 0; I < sizeof (S->GuessedUse) / sizeof (S->GuessedUse[0]); ++I) {
         S->GuessedUse[I] = 0;
     }
@@ -288,9 +288,9 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags
             S->ExportSize = S->AddrSize;
         } else if (S->AddrSize > S->ExportSize) {
             /* We're exporting a symbol smaller than it actually is */
-            PWarning (GetSymPos (S), 1, "Symbol `%m%p' is %s but exported %s",
-                      GetSymName (S), AddrSizeToStr (S->AddrSize),
-                      AddrSizeToStr (S->ExportSize));
+            LIWarning (&S->LineInfos, 1, "Symbol `%m%p' is %s but exported %s",
+                       GetSymName (S), AddrSizeToStr (S->AddrSize),
+                       AddrSizeToStr (S->ExportSize));
         }
     }
 
@@ -627,6 +627,11 @@ SymTable* GetSymParentScope (SymEntry* S)
     if ((S->Flags & SF_LOCAL) != 0) {
         /* This is a cheap local symbol */
         return 0;
+    } else if (S->Sym.Tab == 0) {
+        /* Symbol not in a table. This may happen if there have been errors
+         * before. Return NULL in this case to avoid further errors.
+         */
+        return 0;
     } else {
         /* This is a global symbol */
         return S->Sym.Tab->Parent;