shithub: rgbds

Download patch

ref: c7322258fc4cab0c0e68926e8fea107731b02eda
parent: 036b6c1b89583f1cfe963d05d972a05df40deb4e
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri Nov 19 16:36:56 EST 2021

Refactor `readGfxConstant` for consistency, and edit warning message

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -1263,7 +1263,7 @@
 
 	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,7 +1284,6 @@
 		}
 		if (width < 9)
 			width++;
-		shiftChar();
 	}
 
 	if (width == 0)
@@ -1291,7 +1290,7 @@
 		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;
 }
--- a/test/asm/overflow.err
+++ b/test/asm/overflow.err
@@ -5,4 +5,4 @@
 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