summaryrefslogtreecommitdiffstats
path: root/share
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
commit0e8b426f52c6c684be38fc829e24f9380b906919 (patch)
treeef1073e848ceb5e2a44996df5201be410713ff61 /share
parentcc5a6b42dd64cdbc9767715c4ca475b70a995466 (diff)
downloadtxr-0e8b426f52c6c684be38fc829e24f9380b906919.tar.gz
txr-0e8b426f52c6c684be38fc829e24f9380b906919.tar.bz2
txr-0e8b426f52c6c684be38fc829e24f9380b906919.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.
Diffstat (limited to 'share')
-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