shithub: rgbds

Download patch

ref: 07861b3b4ae1dca290fd89fb96fbee964ce28a01
parent: 24439003f3dd4e55251d8d3271a810dc57ec7de5
author: AntonioND <[email protected]>
date: Wed Apr 5 19:30:35 EDT 2017

Output warning with deprecated section types

Code that uses keywords HOME, DATA, CODE or BSS generates warnings.

Signed-off-by: AntonioND <[email protected]>

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -513,6 +513,7 @@
 %token	T_POP_PUSHO
 %token	T_POP_OPT
 %token	T_SECT_WRAM0 T_SECT_VRAM T_SECT_ROMX T_SECT_ROM0 T_SECT_HRAM T_SECT_WRAMX T_SECT_SRAM T_SECT_OAM
+%token	T_SECT_HOME T_SECT_DATA T_SECT_CODE T_SECT_BSS
 
 %token	T_Z80_ADC T_Z80_ADD T_Z80_AND
 %token	T_Z80_BIT
@@ -1151,6 +1152,22 @@
 	|	T_SECT_WRAMX	{ $$=SECT_WRAMX; }
 	|	T_SECT_SRAM	{ $$=SECT_SRAM; }
 	|	T_SECT_OAM	{ $$=SECT_OAM; }
+	|	T_SECT_HOME	{
+					warning("HOME section name is deprecated, use ROM0 instead.");
+					$$=SECT_ROM0;
+				}
+	|	T_SECT_DATA	{
+					warning("DATA section name is deprecated, use ROMX instead.");
+					$$=SECT_ROMX;
+				}
+	|	T_SECT_CODE	{
+					warning("CODE section name is deprecated, use ROMX instead.");
+					$$=SECT_ROMX;
+				}
+	|	T_SECT_BSS	{
+					warning("BSS section name is deprecated, use WRAM0 instead.");
+					$$=SECT_WRAM0;
+				}
 ;
 
 
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -329,17 +329,19 @@
 	{"endc", T_POP_ENDC},
 
 	{"wram0", T_SECT_WRAM0},
-	{"bss", T_SECT_WRAM0}, /* deprecated */
 	{"vram", T_SECT_VRAM},
-	{"code", T_SECT_ROMX}, /* deprecated */
-	{"data", T_SECT_ROMX}, /* deprecated */
 	{"romx", T_SECT_ROMX},
-	{"home", T_SECT_ROM0}, /* deprecated */
 	{"rom0", T_SECT_ROM0},
 	{"hram", T_SECT_HRAM},
 	{"wramx", T_SECT_WRAMX},
 	{"sram", T_SECT_SRAM},
 	{"oam", T_SECT_OAM},
+
+	/* Deprecated section type names */
+	{"home", T_SECT_HOME},
+	{"code", T_SECT_CODE},
+	{"data", T_SECT_DATA},
+	{"bss", T_SECT_BSS},
 
 	{NAME_RB, T_POP_RB},
 	{NAME_RW, T_POP_RW},