From f8d6e538338b9d2635b8f933325f920c0ea21e06 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 22 Mar 2017 06:49:03 -0700 Subject: Bugfix: missing warnings when main file is .txr. If the main file of an application is a .txr file, unbound function and variable warnings are not being generated. * match.c (v_load): For consistency with the load function in eval.c, release deferred warnings in the normal return case, if we are not a recursive load. However, this doesn't fix anything because a load or include is always recursive being invoked from a .txr file that is being loaded. The problem is in fact that the recursive flag is nil when it shouldn't be, and then the uw_unwind block obliterates the warnings. * txr.c (txr_main): We must bind *load-recursive* to t around not just the loading of Lisp, but also of TXR. Otherwise the individual loads will release warnings, raising false positives for forward references. --- match.c | 3 +++ txr.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/match.c b/match.c index b7692e11..4a34b544 100644 --- a/match.c +++ b/match.c @@ -4245,6 +4245,9 @@ static val v_load(match_files_ctx *c) dyn_env = saved_dyn_env; + if (!rec) + uw_release_deferred_warnings(); + uw_unwind { close_stream(stream, nil); if (!rec) diff --git a/txr.c b/txr.c index b15d275a..afe07971 100644 --- a/txr.c +++ b/txr.c @@ -969,6 +969,8 @@ int txr_main(int argc, char **argv) reg_var(args_s, or2(orig_args, arg_list)); reg_varl(intern(lit("self-path"), user_package), spec_file_str); + env_vbind(dyn_env, load_recursive_s, t); + if (!txr_lisp_p) { int gc = gc_state(0); @@ -1012,8 +1014,6 @@ int txr_main(int argc, char **argv) reg_varl(car(binding), cdr(binding)); } - env_vbind(dyn_env, load_recursive_s, t); - { val result = read_eval_stream(parse_stream, std_error, t); -- cgit v1.2.3