From c7322258fc4cab0c0e68926e8fea107731b02eda Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 19 Nov 2021 21:36:56 -0500 Subject: [PATCH] Refactor `readGfxConstant` for consistency, and edit warning message --- src/asm/lexer.c | 5 ++--- test/asm/overflow.err | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 8b47a059..54f70e54 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -1263,7 +1263,7 @@ static uint32_t readGfxConstant(void) dbgPrint("Reading gfx constant with digits [%c,%c,%c,%c]\n", gfxDigits[0], gfxDigits[1], gfxDigits[2], gfxDigits[3]); - for (;;) { + for (;; shiftChar()) { int c = peek(); uint32_t pixel; @@ -1284,14 +1284,13 @@ static uint32_t readGfxConstant(void) } if (width < 9) width++; - shiftChar(); } if (width == 0) error("Invalid graphics constant, no digits after '`'\n"); else if (width == 9) warning(WARNING_LARGE_CONSTANT, - "Graphics constant is too long, only 8 first pixels considered\n"); + "Graphics constant is too long, only first 8 pixels considered\n"); return bp1 << 8 | bp0; } diff --git a/test/asm/overflow.err b/test/asm/overflow.err index f3725e87..a8ea1830 100644 --- a/test/asm/overflow.err +++ b/test/asm/overflow.err @@ -5,4 +5,4 @@ warning: overflow.asm(24): [-Wdiv] warning: overflow.asm(38): [-Wlarge-constant] Integer constant is too large warning: overflow.asm(41): [-Wlarge-constant] - Graphics constant is too long, only 8 first pixels considered + Graphics constant is too long, only first 8 pixels considered