From c6d7e940e105958e4303eba504cf147b7f428cdf Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 20 Jan 2023 22:39:17 -0800 Subject: fix --no-debug-support configuration. * debug.h (debug_init): Define as ((void) 0) macro in the no debug support case. * unwind.h (uw_last_form_expanded): No-debug-support version must yield a value, not void. * unwind.c (ffcal_frame_type, eval_frame_type, expand_frame_type): Define only if CONFIG_DEBUG_SUPPORT is enabled, to suppress unused warnings. * eval.c (do_eval): Conditionally define debug-related code. The uw_push_eval function doesn't exist if CONFIG_DEBUG_SUPPORT isn't enabled. --- debug.h | 1 + eval.c | 6 ++++++ unwind.c | 2 ++ unwind.h | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debug.h b/debug.h index 825aa8d7..c74e7a4e 100644 --- a/debug.h +++ b/debug.h @@ -74,6 +74,7 @@ void debug_dump_backtrace(val stream, val prefix); #else +#define debug_init() ((void) 0) #define debug_clear(mask) 0 #define debug_set(mask) 0 #define debug_restore(state) ((void) 0) diff --git a/eval.c b/eval.c index a150eaa6..5c739989 100644 --- a/eval.c +++ b/eval.c @@ -1609,13 +1609,17 @@ static val do_eval(val form, val env, val ctx, val (*lookup)(val env, val sym)) { val self = lit("eval"); +#if CONFIG_DEBUG_SUPPORT uw_frame_t *ev = 0; +#endif val ret = nil; +#if CONFIG_DEBUG_SUPPORT if (dbg_backtrace) { ev = coerce(uw_frame_t *, alloca(sizeof *ev)); uw_push_eval(ev, form, env); } +#endif sig_check_fast(); @@ -1669,8 +1673,10 @@ static val do_eval(val form, val env, val ctx, ret = form; } +#if CONFIG_DEBUG_SUPPORT if (ev != 0) uw_pop_frame(ev); +#endif return ret; } diff --git a/unwind.c b/unwind.c index b7419f8d..844c38aa 100644 --- a/unwind.c +++ b/unwind.c @@ -70,7 +70,9 @@ static val sys_cont_free_s, sys_capture_cont_s; val catch_frame_s; static val frame_type, catch_frame_type, handle_frame_type; +#if CONFIG_DEBUG_SUPPORT static val fcall_frame_type, eval_frame_type, expand_frame_type; +#endif static val deferred_warnings, tentative_defs; diff --git a/unwind.h b/unwind.h index 97d5baaf..a10e241b 100644 --- a/unwind.h +++ b/unwind.h @@ -434,7 +434,7 @@ val uw_find_frames(val extype, val frtype); val uw_find_frames_by_mask(val mask); val uw_last_form_expanded(void); #else -#define uw_last_form_expanded() ((void) 0) +#define uw_last_form_expanded() nil #endif val uw_invoke_catch(val catch_frame, val sym, struct args *); val uw_muffle_warning(val exc, struct args *); -- cgit v1.2.3