~ chicken-core (chicken-5) 7cdf0eb7dfea14998615c64e91a46c40ca1a86b3
commit 7cdf0eb7dfea14998615c64e91a46c40ca1a86b3
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Thu Nov 19 15:55:55 2015 +0100
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Fri Jan 1 17:08:20 2016 +1300
Error out when emitting import libraries for nonexistant modules
This fixes #1188.
Signed-off-by: Evan Hanson <evhan@foldling.org>
diff --git a/NEWS b/NEWS
index 3e4e8bb4..8147af08 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@
declared types exactly. Specializations are matched from first to
last to resolve ambiguities (#1214).
- Compiler rewrites for char{<,>,<=,>=,=}? are now safe (#1122).
+ - When requesting to emit import libraries that don't exist, the
+ compiler now gives an error instead of quietly continuing (#1188).
- Core libraries
- SRFI-18: thread-join! no longer gives an error when passed a
diff --git a/batch-driver.scm b/batch-driver.scm
index a5fa323d..044b6715 100644
--- a/batch-driver.scm
+++ b/batch-driver.scm
@@ -470,6 +470,13 @@
'() )
'((##core#undefined))) ] )
+ (unless (null? import-libraries)
+ (quit "No module definition found for import libraries to emit: ~A"
+ ;; ~S would be confusing: separate with a comma
+ (string-intersperse
+ (map (lambda (il) (->string (car il)))
+ import-libraries) ", ")))
+
(when (pair? compiler-syntax-statistics)
(with-debugging-output
'S
diff --git a/compiler.scm b/compiler.scm
index c706942a..48befa61 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -874,6 +874,9 @@
(lambda (il)
(when enable-module-registration
(emit-import-lib name il))
+ ;; Remove from list to avoid error
+ (set! import-libraries
+ (delete il import-libraries))
(values
(reverse xs)
'((##core#undefined)))))
Trap