shithub: sl

Download patch

ref: 708fe523bcbd24d236f0ebd20c002ba3a8eebc84
parent: 06a5c4a57ec148d3a965e3a3cce8d370ed47e1b3
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Jan 25 22:01:23 EST 2025

fix/disable more warnings

--- a/3rd/fn.h
+++ b/3rd/fn.h
@@ -150,9 +150,9 @@
 static inline uint8_t
 knybble(const char *key, uint32_t off, uint32_t shift)
 {
-	uint32_t word = ((uint8_t*)key)[off]<<8;
+	uint32_t word = ((const uint8_t*)key)[off]<<8;
 	if(word)
-		word |= ((uint8_t*)key)[off+1];
+		word |= ((const uint8_t*)key)[off+1];
 	uint32_t right = 16 - 5 - shift;
 	return (word >> right) & 0x1FU;
 }
--- a/flisp.c
+++ b/flisp.c
@@ -841,8 +841,8 @@
 }
 
 #if BYTE_ORDER == LITTLE_ENDIAN && defined(MEM_UNALIGNED_ACCESS)
-#define GET_INT32(a) *(int32_t*)(a)
-#define GET_INT16(a) *(int16_t*)(a)
+#define GET_INT32(a) *(const int32_t*)(a)
+#define GET_INT16(a) *(const int16_t*)(a)
 #define PUT_INT32(a, i) \
 	do{ \
 		*(uint32_t*)(a) = (uint32_t)(i); \
--- a/ios.c
+++ b/ios.c
@@ -14,9 +14,9 @@
 void *
 llt_memrchr(const void *s, int c, size_t n)
 {
-	uint8_t *src = (uint8_t*)s + n;
+	const uint8_t *src = (const uint8_t*)s + n;
 	uint8_t uc = c;
-	while(--src >= (uint8_t*)s)
+	while(--src >= (const uint8_t*)s)
 		if(*src == uc)
 			return (void *)src;
 	return nil;
@@ -345,9 +345,9 @@
 		return wrote;
 	}else if(n <= space){
 		if(s->bm == bm_line){
-			char *nl;
+			const char *nl;
 			if((nl = llt_memrchr(data, '\n', n)) != nil){
-				size_t linesz = nl-(char*)data+1;
+				size_t linesz = nl-(const char*)data+1;
 				s->bm = bm_block;
 				wrote += ios_write(s, data, linesz);
 				ios_flush(s);
--- a/meson.build
+++ b/meson.build
@@ -13,12 +13,9 @@
 
 add_project_arguments(
 	#'-Wcast-align=strict',
-	#'-Wcast-qual',
 	#'-Wconversion',
 	#'-Wfloat-equal',
 	#'-Wsign-conversion',
-	#'-Wsuggest-attribute=malloc',
-	#'-Wsuggest-attribute=returns_nonnull',
 	'-Waggregate-return',
 	'-Werror=odr',
 	'-Werror=strict-aliasing',
@@ -52,13 +49,13 @@
 	)
 else
 	add_project_arguments(
+		'-Werror=lto-type-mismatch',
 		'-Wformat-truncation=2',
 		'-Wlogical-op',
-		'-Wunused-const-variable=2',
-		'-Werror=lto-type-mismatch',
 		'-Wsuggest-attribute=const',
 		'-Wsuggest-attribute=noreturn',
 		'-Wsuggest-attribute=pure',
+		'-Wunused-const-variable=2',
 		language: 'c',
 	)
 endif