shithub: femtolisp

Download patch

ref: 994d01dff2f65cbabc5abbd56ff12428e29490b8
parent: df5ad841ec2f08c3f924229cd76581e439d37558
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Dec 26 16:36:30 EST 2024

vm: add and use LABEL(x) macro to refer to labels in op table

--- a/flisp.c
+++ b/flisp.c
@@ -901,10 +901,12 @@
 #undef GOTO_OP_OFFSET
 	};
 #define NEXT_OP goto *ops[*ip++]
+#define LABEL(x) x
 #define OP(x) op_##x:
 	NEXT_OP;
 #include "vm.inc"
 #undef OP
+#undef LABEL
 #undef NEXT_OP
 #pragma GCC diagnostic pop
 #else /* just a usual (portable) switch/case */
@@ -912,9 +914,11 @@
 	while(1){
 		switch(op){
 #define NEXT_OP break
+#define LABEL(x) x
 #define OP(x) case x:
 #include "vm.inc"
 #undef OP
+#undef LABEL
 #undef NEXT_OP
 		}
 		op = *ip++;