summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-04-01 18:21:06 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-04-01 18:21:06 -0700
commit70dbd3666379cf35167785751e86c6780e400396 (patch)
treef840fca34b6ee40b11b258a1005267161892b19f
parentf43667b6df8be57242d88be2f451b2b05867f212 (diff)
downloadtxr-70dbd3666379cf35167785751e86c6780e400396.tar.gz
txr-70dbd3666379cf35167785751e86c6780e400396.tar.bz2
txr-70dbd3666379cf35167785751e86c6780e400396.zip
constantp: muffle all expander warnings.
This fixes nuisance diagnostics from constantp, such as when invalid forms are given. An example is (constantp '(1)). * eval.c (no_ub_warn_expand): New name for previous no_warn_expand function. (no_warn_expand): Rewritten to muffle all warnings, and call no_ub_warn_expand. The constantp function continues to call no_warn_expand. (eval_init): Retarget expand intrinsic to no_ub_warn_expand, to preserve its documented behavior. The only function which currently uses no_warn_expand is constantp.
-rw-r--r--eval.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 51d562ef..63026443 100644
--- a/eval.c
+++ b/eval.c
@@ -5601,7 +5601,7 @@ static val muffle_unbound_warning(val exc, varg args)
return nil;
}
-static val no_warn_expand(val form, val menv)
+static val no_ub_warn_expand(val form, val menv)
{
val ret;
uw_frame_t uw_handler;
@@ -5612,6 +5612,17 @@ static val no_warn_expand(val form, val menv)
return ret;
}
+static val no_warn_expand(val form, val menv)
+{
+ val ret;
+ uw_frame_t uw_handler;
+ uw_push_handler(&uw_handler, cons(warning_s, nil),
+ func_n1v(uw_muffle_warning));
+ ret = no_ub_warn_expand(form, menv);
+ uw_pop_frame(&uw_handler);
+ return ret;
+}
+
static val gather_free_refs(val info_cons, val exc, varg args)
{
val self = lit("expand-with-free-refs");
@@ -7645,7 +7656,7 @@ void eval_init(void)
reg_var(load_search_dirs_s, nil);
reg_var(load_args_s, nil);
reg_var(load_hooks_s, nil);
- reg_fun(intern(lit("expand"), user_package), func_n2o(no_warn_expand, 1));
+ reg_fun(intern(lit("expand"), user_package), func_n2o(no_ub_warn_expand, 1));
reg_fun(intern(lit("expand*"), user_package), func_n2o(expand, 1));
reg_fun(intern(lit("expand-hook-combine"), user_package), func_n2(expand_hook_combine));
reg_fun(intern(lit("expand-with-free-refs"), user_package),