ref: 217c10ddac43fa0b87566bb44bef8236b0eab316
parent: 6a8ae643d5e900b2dbe7d741a1f14df5912cede8
author: Jakub Kądziołka <kuba@kadziolka.net>
date: Sun Oct 11 20:40:33 EDT 2020
Report error when shifting outside a macro
--- a/src/asm/macro.c
+++ b/src/asm/macro.c
@@ -130,7 +130,9 @@
void macro_ShiftCurrentArgs(void)
{
- if (macroArgs->shift != macroArgs->nbArgs)
+ if (!macroArgs)
+ error("Cannot shift macro arguments outside of a macro\n");
+ else if (macroArgs->shift != macroArgs->nbArgs)
macroArgs->shift++;
}
--- /dev/null
+++ b/test/asm/shift-outside-macro.asm
@@ -1,0 +1,1 @@
+shift
--- /dev/null
+++ b/test/asm/shift-outside-macro.err
@@ -1,0 +1,3 @@
+ERROR: shift-outside-macro.asm(1):
+ Cannot shift macro arguments outside of a macro
+error: Assembly aborted (1 errors)!