changeset 481:62720ac9e28d

Exclude extended indirect from operandsizewarning pragma Constant indirect addressing is only available in "extended" variety (16 bits) so make sure no warning appears when plain extended indirect addressing is used.
author William Astle <lost@l-w.ca>
date Wed, 12 Dec 2018 21:18:20 -0700
parents ceed9fb3a362
children 9c24336fa76c
files lwasm/insn_gen.c lwasm/insn_indexed.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/insn_gen.c	Wed Dec 12 21:17:21 2018 -0700
+++ b/lwasm/insn_gen.c	Wed Dec 12 21:18:20 2018 -0700
@@ -322,7 +322,8 @@
 			}
 			else if (l -> lint == 2 && lw_expr_istype(e, lw_expr_type_int) && CURPRAGMA(l, PRAGMA_OPERANDSIZE))
 			{
-				if (l -> pb != 0xAF && l -> pb != 0xB0)
+				// note that W relative and extended indirect must be 16 bits
+				if (l -> pb != 0xAF && l -> pb != 0xB0 && l -> pb != 0x9f)
 				{
 					if ((i >= -128 && i <= 127) || i >= 0xFF80)
 					{
--- a/lwasm/insn_indexed.c	Wed Dec 12 21:17:21 2018 -0700
+++ b/lwasm/insn_indexed.c	Wed Dec 12 21:18:20 2018 -0700
@@ -800,7 +800,8 @@
 			lwasm_register_error(as, l, E_EXPRESSION_NOT_RESOLVED);
 		}
 	}
-	else if (l -> lint == 2 && CURPRAGMA(l, PRAGMA_OPERANDSIZE) && (l -> pb != 0xAF && l -> pb != 0xB0))
+	// note that extended indirect (post byte 0x9f) can only be 16 bits
+	else if (l -> lint == 2 && CURPRAGMA(l, PRAGMA_OPERANDSIZE) && (l -> pb != 0xAF && l -> pb != 0xB0 && l -> pb != 0x9f))
 	{
 		int offs;
 		e = lwasm_fetch_expr(l, 0);