shithub: femtolisp

Download patch

ref: 9c48e4c895915eea3d7d7ee7b3287d23b9766da5
parent: 849389558d7c989902662f32ba956e34ac4e21c5
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Nov 26 15:54:09 EST 2024

remove unused 'op' variable when using computed goto

--- a/flisp.c
+++ b/flisp.c
@@ -856,7 +856,6 @@
 
 	// temporary variables (not necessary to preserve across calls)
 	size_t isz;
-	uint8_t op;
 	uint32_t i, ipd;
 	symbol_t *sym;
 	cons_t *c;
@@ -888,7 +887,7 @@
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic"
 #define OP(x) op_##x:
-#define NEXT_OP goto *ops[op = *ip++]
+#define NEXT_OP goto *ops[*ip++]
 #define GOTO_OP_OFFSET(op) [op] = &&op_##op
 	static const void *ops[] = {
 		GOTO_OP_OFFSET(OP_LOADA0),
@@ -989,7 +988,7 @@
 #else
 #define OP(x) case x:
 #define NEXT_OP break
-	op = *ip++;
+	uint8_t op = *ip++;
 	while(1){
 		switch(op){
 #endif
@@ -1066,10 +1065,10 @@
 						case OP_MUL:	goto apply_mul;
 						case OP_DIV:	goto apply_div;
 						default:
-							op = i;
 #if defined(COMPUTED_GOTO)
 							goto *ops[i];
 #else
+							op = i;
 							continue;
 #endif
 						}