ref: 06f0472f81600459cbe5ae74d7a5253523fd2fc2
parent: dc4a98048dff10c1c39e358faa66d485d33cf41a
author: Ben10do <[email protected]>
date: Tue Jan 24 05:48:38 EST 2017
Emit a single error when using BANK incorrectly Previously, if BANK is used when defining a section that’s not ROMX, WRMAX, SRAM or VRAM, a second error message would appear, e.g. “(null) bank value $1 out of range $5d to $0”. This would appear due to the usage of uninitialised variables. This change ensures that the uninitialised variables are not accessed when using an invalid section. This also silences compiler warnings about usage of uninitialised variables.
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -24,7 +24,7 @@
bankrangecheck(char *name, ULONG secttype, SLONG org, SLONG bank)
{
SLONG minbank, maxbank;
- char *stype;
+ char *stype = NULL;
switch (secttype) {
case SECT_ROMX:
stype = "ROMX";
@@ -51,7 +51,7 @@
"ROMX, WRAMX, SRAM, or VRAM sections");
}
- if (bank < minbank || bank > maxbank) {
+ if (stype && (bank < minbank || bank > maxbank)) {
yyerror("%s bank value $%x out of range ($%x to $%x)",
stype, bank, minbank, maxbank);
}