shithub: femtolisp

Download patch

ref: fbc9ef5b7b48d515382711489c463d7886b5f358
parent: 2d4baeba73c5f08383d21b4183d07a64992be56e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jan 6 16:02:47 EST 2025

fix warnings on openbsd 386

--- a/print.c
+++ b/print.c
@@ -377,10 +377,10 @@
 	value_t label;
 	if((label = (value_t)ptrhash_get(&FL(printconses), (void*)v)) != (value_t)HT_NOTFOUND){
 		if(!ismarked(v)){
-			FL(hpos) += ios_printf(f, "#%"PRIdPTR"#", numval(label));
+			FL(hpos) += ios_printf(f, "#%"PRIdPTR"#", (intptr_t)numval(label));
 			return 1;
 		}
-		FL(hpos) += ios_printf(f, "#%"PRIdPTR"=", numval(label));
+		FL(hpos) += ios_printf(f, "#%"PRIdPTR"=", (intptr_t)numval(label));
 	}
 	if(ismanaged(v))
 		unmark_cons(v);
--- a/read.c
+++ b/read.c
@@ -112,7 +112,7 @@
 	ctx->toktype = TOK_NONE;
 }
 
-static _Noreturn void
+static _Noreturn void __printfmt(2, 3)
 parse_error(ios_loc_t *loc, const char *format, ...)
 {
 	char msgbuf[512];
@@ -671,7 +671,7 @@
 	case TOK_LABEL:
 		// create backreference label
 		if(ptrhash_has(&FL(readstate)->backrefs, (void*)ctx->tokval))
-			parse_error(&ctx->loc, "label %"PRIdPTR" redefined", numval(ctx->tokval));
+			parse_error(&ctx->loc, "label %"PRIdPTR" redefined", (intptr_t)numval(ctx->tokval));
 		oldtokval = ctx->tokval;
 		v = do_read_sexpr(ctx, ctx->tokval);
 		ptrhash_put(&FL(readstate)->backrefs, (void*)oldtokval, (void*)v);
@@ -680,7 +680,7 @@
 		// look up backreference
 		v = (value_t)ptrhash_get(&FL(readstate)->backrefs, (void*)ctx->tokval);
 		if(v == (value_t)HT_NOTFOUND)
-			parse_error(&ctx->loc, "undefined label %"PRIdPTR, numval(ctx->tokval));
+			parse_error(&ctx->loc, "undefined label %"PRIdPTR, (intptr_t)numval(ctx->tokval));
 		return v;
 	case TOK_GENSYM:
 		pv = (value_t*)ptrhash_bp(&FL(readstate)->gensyms, (void*)ctx->tokval);