From 366a7fba840293f54ae49108f4bc5d3d94c848c4 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 20 Jan 2023 23:51:50 -0800 Subject: fix --no-gen-gc configuration. This fixes only the build. I'm getting a crash in one test case, namely tests/010/json.tl. * lib.h (mut): Remove stray semicolon from definition. This semicolon compensates for the lack of a semicolon in txr.c, which becomes a syntax errror under no-gen-gc, when the other definition of mut is active. (mkloc, setcheck): Let's add casts of the object argument to void. This gets rid of a number of unused parameter errors in various functions that take an object parameter that is only used in the case of generational GC. * txr.c (txr_main): Add missing semicolon after mut call. * gc.c (gc_wrap): In the no CONFIG_GEN_GC case, cast argument full to void, since it is unused. --- gc.c | 2 ++ lib.h | 6 +++--- txr.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gc.c b/gc.c index 02a0cb9c..25b4c071 100644 --- a/gc.c +++ b/gc.c @@ -1053,6 +1053,8 @@ static val gc_wrap(val full) #if CONFIG_GEN_GC if (!null_or_missing_p(full)) full_gc = 1; +#else + (void) full; #endif gc(); return t; diff --git a/lib.h b/lib.h index 8aa23a3f..f3cd8429 100644 --- a/lib.h +++ b/lib.h @@ -411,18 +411,18 @@ INLINE loc mkloc_fun(val *ptr, val obj) #define valptr(lo) ((lo).ptr) #define set(lo, val) (gc_set(lo, val)) #define setcheck(tgt, src) (gc_assign_check(tgt, src)) -#define mut(obj) (gc_mutated(obj)); +#define mut(obj) (gc_mutated(obj)) #define mpush(val, lo) (gc_push(val, lo)) #else typedef val *loc; -#define mkloc(expr, obj) (&(expr)) +#define mkloc(expr, obj) ((void) (obj), &(expr)) #define mkcloc(expr) (&(expr)) #define nulloc ((loc) 0) #define nullocp(lo) (!(lo)) #define deref(lo) (*(lo)) #define valptr(lo) (lo) #define set(lo, val) (*(lo) = (val)) -#define setcheck(tgt, src) ((void) 0) +#define setcheck(tgt, src) ((void) (tgt)) #define mut(obj) ((void) (obj)) #define mpush(val, lo) (push(val, lo)) #endif diff --git a/txr.c b/txr.c index 5a4f3b77..90036983 100644 --- a/txr.c +++ b/txr.c @@ -1208,7 +1208,7 @@ int txr_main(int argc, char **argv) val parser_obj = ensure_parser(parse_stream, spec_file_str); parser_t *parser = parser_get_impl(prog_string, parser_obj); parse_once_noerr(parse_stream, spec_file_str); - mut(parser_obj) + mut(parser_obj); gc_state(gc); close_stream(parse_stream, nil); -- cgit v1.2.3