shithub: femtolisp

Download patch

ref: 465e49a46ffd47fde8b915202773bcc9b34eec57
parent: 8837293e1085d71e10ef9216c457458450419801
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Mar 31 19:47:59 EDT 2023

satisfy the stupid compilers

--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@
 TARG=flisp
 LLT=llt/libllt.a
 CFLAGS?=-O2 -g
-CFLAGS+=-Wall -Wextra -std=c99 -D_DEFAULT_SOURCE
+CFLAGS+=-Wall -Wextra -Wno-parentheses -std=c99 -D_DEFAULT_SOURCE
 LDFLAGS?=
 
 OBJS=\
--- a/cvalues.c
+++ b/cvalues.c
@@ -1339,7 +1339,7 @@
     lltint_t ai, bi;
     numerictype_t ta, tb, itmp;
     void *aptr=nil, *bptr=nil, *ptmp;
-    mpint *bmp, *resmp;
+    mpint *bmp = nil, *resmp = nil;
     int64_t b64;
 
     if (!num_to_ptr(a, &ai, &ta, &aptr) || ta >= T_FLOAT)
@@ -1360,6 +1360,7 @@
             bmp = conv_to_mpint(bptr, tb);
             resmp = bmp;
         }
+        b64 = 0;
     }
     else
         b64 = conv_to_int64(bptr, tb);
--- a/llt/mpfmt.c
+++ b/llt/mpfmt.c
@@ -128,7 +128,7 @@
 			else if(x != 0)
 				return -1;
 			*out = '0' + (x & 7);
-			x = y >> Dbits-i;
+			x = y >> (Dbits-i);
 		}
 	}
 	if(i > 0)
--- a/llt/mptod.c
+++ b/llt/mptod.c
@@ -49,7 +49,7 @@
 			return a->sign < 0 ? D_NINF : D_PINF;
 	}
 	x.lo = v;
-	x.hi = (u32int)(v >> 32) & (1<<20) - 1 | sf + 1022 << 20 | a->sign & 1<<31;
+	x.hi = (u32int)(v >> 32) & (1<<20) - 1 | (sf + 1022) << 20 | a->sign & 1<<31;
 	return x.x;
 }
 
@@ -71,7 +71,7 @@
 	}
 	v = x.lo | (uvlong)(x.hi & (1<<20) - 1) << 32 | 1ULL<<52;
 	if(e < 1075){
-		v += (1ULL<<1074 - e) - (~v >> 1075 - e & 1);
+		v += (1ULL<<(1074 - e)) - (~v >> (1075 - e) & 1);
 		v >>= 1075 - e;
 	}
 	uvtomp(v, a);
--- a/llt/mpvectscmp.c
+++ b/llt/mpvectscmp.c
@@ -10,12 +10,12 @@
 		v = 0;
 		while(alen > blen)
 			v |= a[--alen];
-		m = p = (-v^v|v)>>Dbits-1;
+		m = p = (-v^v|v)>>(Dbits-1);
 	} else if(blen > alen){
 		v = 0;
 		while(blen > alen)
 			v |= b[--blen];
-		m = (-v^v|v)>>Dbits-1;
+		m = (-v^v|v)>>(Dbits-1);
 		p = m^1;
 	} else
 		m = p = 0;
@@ -24,8 +24,8 @@
 		y = b[alen];
 		z = x - y;
 		x = ~x;
-		v = ((-z^z|z)>>Dbits-1) & ~m;
-		p = ((~(x&y|x&z|y&z)>>Dbits-1) & v) | (p & ~v);
+		v = ((-z^z|z)>>(Dbits-1)) & ~m;
+		p = ((~(x&y|x&z|y&z)>>(Dbits-1)) & v) | (p & ~v);
 		m |= v;
 	}
 	return (p-m) | m;
--- a/llt/strtomp.c
+++ b/llt/strtomp.c
@@ -51,7 +51,7 @@
 Digout:
 			i -= Dbits;
 			b->p[b->top++] = x;
-			x = y >> 3-i;
+			x = y >> (3-i);
 		}
 	}
 	if(i > 0)
--- a/maxstack.inc
+++ b/maxstack.inc
@@ -135,7 +135,7 @@
             break;
 
         case OP_LOADCL:
-            sp++;
+            sp++; // fallthrough
         case OP_SETCL:
             SWAP_INT32(ip);
             ip += 4;