shithub: rgbds

Download patch

ref: f69e666b00dcfc6cde763100af4049c50610f2dc
parent: eba06404f036f17819b6a51e01bd246ef993f7d2
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Thu Apr 15 14:38:50 EDT 2021

expansionOfs cannot be negative

lexerState->expansionOfs is always either set to 0, or updated by
adding a positive quantity:

    if (distance > lexerState->expansions->distance) {
        lexerState->expansionOfs += distance - lexerState->expansions->distance;
        ...
    }

so it will always be positive or zero.

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -364,7 +364,7 @@
 	size_t macroArgScanDistance; /* Max distance already scanned for macro args */
 	bool expandStrings;
 	struct Expansion *expansions;
-	size_t expansionOfs; /* Offset into the current top-level expansion (negative = before) */
+	size_t expansionOfs; /* Offset into the current top-level expansion */
 };
 
 struct LexerState *lexerState = NULL;