shithub: rgbds

Download patch

ref: e3ef194b4fc35c5d004c586c10a30c02e8707456
parent: ab4ca9ad8c3e7a590291e12b3e1b1011a3d279b3
author: ISSOtm <eldredhabert0@gmail.com>
date: Wed Jan 22 05:44:44 EST 2020

Remove local label error checking
This is actually not necessary, because RGBLINK would warn about missing labels.
Besides, through semi-esoteric ways, it is possible to define more labels in this scope,
and there's no reason to prevent that.

--- a/include/asm/output.h
+++ b/include/asm/output.h
@@ -40,7 +40,6 @@
 void out_RelByte(struct Expression *expr);
 void out_RelWord(struct Expression *expr);
 void out_PCRelByte(struct Expression *expr);
-void out_CheckErrors(void);
 void out_WriteObject(void);
 void out_Skip(int32_t skip);
 void out_BinaryFile(char *s);
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -471,7 +471,6 @@
 			       (int)(60 / timespent * nTotalLines));
 	}
 
-	out_CheckErrors();
 	/* If no path specified, don't write file */
 	if (tzObjectname != NULL)
 		out_WriteObject();
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -527,34 +527,6 @@
 }
 
 /*
- * Check for errors that could happen while writing an object file
- * This is important as out_WriteObject is skipped entirely when `-o` is omitted
- * Therefore, errors such as memory allocations still should be handled in
- * out_WriteObject and not here
- */
-void out_CheckErrors(void)
-{
-	/* Local symbols cannot be imported from elsewhere */
-	struct PatchSymbol *pSym = pPatchSymbols;
-
-	while (pSym) {
-		struct sSymbol const *pSymbol = pSym->pSymbol;
-
-		if (!(pSymbol->nType & SYMF_DEFINED)
-		   && pSymbol->nType & SYMF_LOCAL) {
-			char const *name = pSymbol->tzName;
-			char const *localPtr = strchr(name, '.');
-
-			if (localPtr)
-				name = localPtr;
-			errx(1, "%s(%u) : '%s' not defined",
-			     pSymbol->tzFileName, pSymbol->nFileLine, name);
-		}
-		pSym = pSym->pNext;
-	}
-}
-
-/*
  * Write an objectfile
  */
 void out_WriteObject(void)
--- a/test/asm/undefined-dot.err
+++ b/test/asm/undefined-dot.err
@@ -1,1 +1,0 @@
-error: undefined-dot.asm(3) : '.' not defined