Skip to content

Commit aa7db6a

Browse files
committed
Only warn about unmapped characters in non-empty charmaps
Fixes #1058
1 parent 3567faf commit aa7db6a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/asm/charmap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,8 @@ size_t charmap_ConvertNext(char const **input, uint8_t **output)
249249
if (output)
250250
*output += codepointLen;
251251

252-
// Check if the character map is not the default "main" one, or if
253-
// it has any mappings defined
254-
if (strcmp(charmap->name, "main") || charmap->usedNodes > 1)
252+
// Warn if this character is not mapped but any others are
253+
if (charmap->usedNodes > 1)
255254
warning(WARNING_UNMAPPED_CHAR,
256255
"Unmapped character %s\n", printChar(firstChar));
257256

test/asm/unmapped-char.asm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ SECTION "test", ROM0
44

55
pushc
66
newcharmap custom
7-
db "A" ; unmapped in non-default charmap
7+
db "A" ; OK, unmapped in non-default empty charmap
8+
charmap "C", $99
9+
db "A" ; unmapped in non-empty charmap
810
popc
911

1012
db "A" ; OK, default empty charmap again

test/asm/unmapped-char.err

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: unmapped-char.asm(7): [-Wunmapped-char]
1+
warning: unmapped-char.asm(9): [-Wunmapped-char]
22
Unmapped character 'A'
3-
warning: unmapped-char.asm(13): [-Wunmapped-char]
3+
warning: unmapped-char.asm(15): [-Wunmapped-char]
44
Unmapped character 'A'

0 commit comments

Comments
 (0)