summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-23 18:21:24 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-23 18:21:24 -0700
commitef185cc32a86458ca8846e3704c097d491e9d556 (patch)
treeef1073e848ceb5e2a44996df5201be410713ff61
parent3c69ae9ca11ac0f4bcfe6f689240fa6ddef6c082 (diff)
downloadtxr-ef185cc32a86458ca8846e3704c097d491e9d556.tar.gz
txr-ef185cc32a86458ca8846e3704c097d491e9d556.tar.bz2
txr-ef185cc32a86458ca8846e3704c097d491e9d556.zip
compiler: bugfix: warnings deferred too far.
Because with-compilation-unit is keyed of *load-recursive*, when compilation is happening in the context of a load (a top-level form in a loaded file calls compile-file or compile-update file) warnings are deferred until the end of the load. That might never occur if the load doesn't complete, because, say, the image quits for some reason. If the following is the content of a file which is loaded: (compile-file "foo") (exit 0) then warnings during the compilation are not issued when compile-file terminates, and will never be issued because of the termination due to the exit call. * share/txr/stdlib/compiler.tl (*in-compilation-unit*): New special variable. (with-compilation-unit): Use *in-compilation-unit* to determinw when a compilation unit has ended, and dump all the deferred warnings then. We will bind *load-recursive* because that is required for deferring warnings.
-rw-r--r--share/txr/stdlib/compiler.tl5
1 files changed, 4 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 0e0f3f4f..e56dea66 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -334,6 +334,8 @@
(defvarl assumed-fun)
+(defvar *in-compilation-unit* nil)
+
(defvar *dedup*)
(defvar *unchecked-calls*)
@@ -2219,7 +2221,8 @@
(defmacro usr:with-compilation-unit (. body)
(with-gensyms (rec)
- ^(let* ((,rec sys:*load-recursive*)
+ ^(let* ((,rec *in-compilation-unit*)
+ (*in-compilation-unit* t)
(sys:*load-recursive* t)
(*dedup* (or *dedup* (hash))))
(unwind-protect