summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-03-22 06:49:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-03-22 06:49:03 -0700
commitf8d6e538338b9d2635b8f933325f920c0ea21e06 (patch)
tree7e991b9d96a0171666aab06f1b65e8a5ecc77023
parent7e2f1500f34098be4a0cc0b2130cffb3a729793b (diff)
downloadtxr-f8d6e538338b9d2635b8f933325f920c0ea21e06.tar.gz
txr-f8d6e538338b9d2635b8f933325f920c0ea21e06.tar.bz2
txr-f8d6e538338b9d2635b8f933325f920c0ea21e06.zip
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.
-rw-r--r--match.c3
-rw-r--r--txr.c4
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);