From b1d4be66e49ba1b722e9a7a072c39b22f0f9c7e5 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 4 Dec 2019 01:56:06 +0100 Subject: [PATCH] Remove deprecated "section charmap" feature --- include/asm/output.h | 1 - src/asm/charmap.c | 49 ++-------------------------------- src/asm/output.c | 1 - test/asm/multiple-charmaps.asm | 2 +- test/asm/multiple-charmaps.out | 6 ++--- 5 files changed, 5 insertions(+), 54 deletions(-) diff --git a/include/asm/output.h b/include/asm/output.h index 306bb697..be396b16 100644 --- a/include/asm/output.h +++ b/include/asm/output.h @@ -22,7 +22,6 @@ struct Section { uint32_t nAlign; struct Section *pNext; struct Patch *pPatches; - struct Charmap *charmap; uint8_t *tData; }; diff --git a/src/asm/charmap.c b/src/asm/charmap.c index 60ed4422..253373cb 100644 --- a/src/asm/charmap.c +++ b/src/asm/charmap.c @@ -33,17 +33,6 @@ static struct Charmap *currentCharmap; struct CharmapStackEntry *charmapStack; -static void warnSectionCharmap(void) -{ - static bool warned = false; - - if (warned) - return; - - warning(WARNING_OBSOLETE, "Using 'charmap' within a section when the current charmap is 'main' is deprecated"); - warned = true; -} - static uint32_t charmap_CalcHash(const char *s) { return calchash(s) % CHARMAP_HASH_SIZE; @@ -163,30 +152,9 @@ int32_t charmap_Add(char *input, uint8_t output) int32_t i; uint8_t v; - struct Charmap *charmap; + struct Charmap *charmap = currentCharmap; struct Charnode *curr_node, *temp_node; - /* - * If the user tries to define a character mapping inside a section - * and the current global charmap is the "main" one, then a local - * section charmap will be created or modified instead of the global - * one. In other words, the local section charmap can override the - * main global one, but not the others. - */ - if (pCurrentSection && currentCharmap == mainCharmap) { - warnSectionCharmap(); - if (pCurrentSection->charmap) { - charmap = pCurrentSection->charmap; - } else { - charmap = calloc(1, sizeof(struct Charmap)); - if (charmap == NULL) - fatalerror("Not enough memory for charmap"); - pCurrentSection->charmap = charmap; - } - } else { - charmap = currentCharmap; - } - if (charmap->charCount >= MAXCHARMAPS || strlen(input) > CHARMAPLENGTH) return -1; @@ -217,7 +185,7 @@ int32_t charmap_Add(char *input, uint8_t output) int32_t charmap_Convert(char **input) { - struct Charmap *charmap; + struct Charmap *charmap = currentCharmap; struct Charnode *charnode; char *output; @@ -226,19 +194,6 @@ int32_t charmap_Convert(char **input) int32_t i, match, length; uint8_t v, foundCode; - /* - * If there is a local section charmap and the current global charmap - * is the "main" one, the local one is used. Otherwise, the global - * one is used. In other words, the local section charmap can override - * the main global one, but not the others. - */ - if (pCurrentSection && - pCurrentSection->charmap && - currentCharmap == mainCharmap) - charmap = pCurrentSection->charmap; - else - charmap = currentCharmap; - output = malloc(strlen(*input)); if (output == NULL) fatalerror("Not enough memory for buffer"); diff --git a/src/asm/output.c b/src/asm/output.c index f34ac0ba..21aa0ead 100644 --- a/src/asm/output.c +++ b/src/asm/output.c @@ -642,7 +642,6 @@ struct Section *out_FindSection(char *pzName, uint32_t secttype, int32_t org, pSect->nAlign = alignment; pSect->pNext = NULL; pSect->pPatches = NULL; - pSect->charmap = NULL; /* It is only needed to allocate memory for ROM sections. */ if (sect_HasData(secttype)) { diff --git a/test/asm/multiple-charmaps.asm b/test/asm/multiple-charmaps.asm index 0a410652..18239a0f 100644 --- a/test/asm/multiple-charmaps.asm +++ b/test/asm/multiple-charmaps.asm @@ -71,7 +71,7 @@ SECTION "sec0", ROM0 print "ab" -printt "override main charmap\n" +printt "modify main charmap\n" charmap "ef", $3 print "ab" diff --git a/test/asm/multiple-charmaps.out b/test/asm/multiple-charmaps.out index 34647462..b1fc6857 100644 --- a/test/asm/multiple-charmaps.out +++ b/test/asm/multiple-charmaps.out @@ -1,5 +1,3 @@ -warning: multiple-charmaps.asm(75): [-Wobsolete] - Using 'charmap' within a section when the current charmap is 'main' is deprecated ERROR: multiple-charmaps.asm(100) -> multiple-charmaps.asm::new_(7): Charmap 'map1' already exists ERROR: multiple-charmaps.asm(102) -> multiple-charmaps.asm::set_(13): @@ -24,8 +22,8 @@ $1 $6364 setcharmap main $0 -override main charmap -$6162 +modify main charmap +$0 $3 setcharmap map1 pushc