diff --git a/.github/scripts/get_win_deps.ps1 b/.github/scripts/get_win_deps.ps1 index b947ad5c..8306e3ec 100644 --- a/.github/scripts/get_win_deps.ps1 +++ b/.github/scripts/get_win_deps.ps1 @@ -15,9 +15,9 @@ function getlibrary ([string] $URI, [string] $filename, [string] $hash, [string] Expand-Archive -DestinationPath $destdir $filename } -getlibrary 'https://www.zlib.net/zlib1213.zip' 'zlib.zip' 'd233fca7cf68db4c16dc5287af61f3cd01ab62495224c66639ca3da537701e42' . +getlibrary 'https://www.zlib.net/zlib13.zip' 'zlib.zip' 'c561d09347f674f0d72692e7c75d9898919326c532aab7f8c07bb43b07efeb38' . getlibrary 'https://download.sourceforge.net/libpng/lpng1637.zip' 'libpng.zip' '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2' . getlibrary 'https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip' 'winflexbison.zip' '39c6086ce211d5415500acc5ed2d8939861ca1696aee48909c7f6daf5122b505' install_dir -Move-Item zlib-1.2.13 zlib +Move-Item zlib-1.3 zlib Move-Item lpng1637 libpng diff --git a/src/asm/symbol.c b/src/asm/symbol.c index 4a565d7a..d54fff9c 100644 --- a/src/asm/symbol.c +++ b/src/asm/symbol.c @@ -525,16 +525,14 @@ static struct Symbol *addLabel(char const *symName) // Add a local (`.name` or `Parent.name`) relocatable symbol struct Symbol *sym_AddLocalLabel(char const *symName) { - if (!labelScope) { - error("Local label '%s' in main scope\n", symName); - return NULL; - } - assert(!strchr(labelScope, '.')); // Assuming no dots in `labelScope` + // Assuming no dots in `labelScope` if defined + assert(!labelScope || !strchr(labelScope, '.')); char fullName[MAXSYMLEN + 1]; char const *localName = strchr(symName, '.'); assert(localName); // There should be at least one dot in `symName` + // Check for something after the dot in `localName` if (localName[1] == '\0') { fatalerror("'%s' is a nonsensical reference to an empty local label\n", @@ -546,23 +544,13 @@ struct Symbol *sym_AddLocalLabel(char const *symName) symName); if (localName == symName) { + if (!labelScope) { + error("Unqualified local label '%s' in main scope\n", symName); + return NULL; + } // Expand `symName` to the full `labelScope.symName` name fullSymbolName(fullName, sizeof(fullName), symName, labelScope); symName = fullName; - } else { - size_t i = 0; - - // Find where `labelScope` and `symName` first differ - while (labelScope[i] && symName[i] == labelScope[i]) - i++; - - // Check that `symName` starts with `labelScope` and then a '.' - if (labelScope[i] != '\0' || symName[i] != '.') { - size_t parentLen = localName - symName; - - assert(parentLen <= INT_MAX); - error("Not currently in the scope of '%.*s'\n", (int)parentLen, symName); - } } return addLabel(symName); diff --git a/test/asm/local-without-parent.err b/test/asm/local-without-parent.err index 4f1db1e3..71e2a7f5 100644 --- a/test/asm/local-without-parent.err +++ b/test/asm/local-without-parent.err @@ -1,3 +1,3 @@ error: local-without-parent.asm(2): - Local label '.test' in main scope + Unqualified local label '.test' in main scope error: Assembly aborted (1 error)! diff --git a/test/asm/local-wrong-parent.asm b/test/asm/local-wrong-parent.asm deleted file mode 100644 index 5cc3660a..00000000 --- a/test/asm/local-wrong-parent.asm +++ /dev/null @@ -1,6 +0,0 @@ -SECTION "sec", ROM0 - -Parent: - db 0 -WrongParent.child - db 0 diff --git a/test/asm/local-wrong-parent.err b/test/asm/local-wrong-parent.err deleted file mode 100644 index 2b12513d..00000000 --- a/test/asm/local-wrong-parent.err +++ /dev/null @@ -1,3 +0,0 @@ -error: local-wrong-parent.asm(5): - Not currently in the scope of 'WrongParent' -error: Assembly aborted (1 error)! diff --git a/test/asm/local-wrong-parent.out b/test/asm/local-wrong-parent.out deleted file mode 100644 index e69de29b..00000000 diff --git a/test/asm/sym-scope.asm b/test/asm/sym-scope.asm index 2a704d34..496bba14 100644 --- a/test/asm/sym-scope.asm +++ b/test/asm/sym-scope.asm @@ -1,8 +1,9 @@ SECTION "Scopes", ROM0 -; Neither of these should be created -.tooSoon -Nice.try +; Tests of injecting local labels into another label's scope. +; This construction is useful to define a subroutine's local variables +; in WRAM or HRAM. +Valid.syntax Parent: .loc @@ -11,8 +12,8 @@ Parent.explicit dw .explicit ; This should expand to the above -; None of the two locals below should manage to be created, being in the wrong scopes -; Note however that `Parentheses` begins with `Parent`, which string checks may fail to handle +; Note that `Parentheses` begins with `Parent`, +; which string checks may fail to handle Parentheses.check diff --git a/test/asm/sym-scope.err b/test/asm/sym-scope.err index 0ff9a0a7..e69de29b 100644 --- a/test/asm/sym-scope.err +++ b/test/asm/sym-scope.err @@ -1,9 +0,0 @@ -error: sym-scope.asm(4): - Local label '.tooSoon' in main scope -error: sym-scope.asm(5): - Local label 'Nice.try' in main scope -error: sym-scope.asm(17): - Not currently in the scope of 'Parentheses' -error: sym-scope.asm(21): - Not currently in the scope of 'Parent' -error: Assembly aborted (4 errors)!