Evaluate the `export' and `re-export' forms at compile-time.
authorLudovic Courtès <ludo@gnu.org>
Mon, 11 Jan 2010 17:30:13 +0000 (18:30 +0100)
committerLudovic Courtès <ludo@gnu.org>
Mon, 11 Jan 2010 17:31:02 +0000 (18:31 +0100)
* module/ice-9/boot-9.scm (export, re-export): Evaluate at compile-time
  in addition to load/eval.

* test-suite/tests/tree-il.test ("warnings")["unused-toplevel"]("unused
  but define-public"): Remove throw to `unresolved'.

module/ice-9/boot-9.scm
test-suite/tests/tree-il.test

index a32e2b64f143cb5ff10eb5954905961ee5ecc0d5..af09be82b808dd0faed891001b3dfcc473f16e85 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*- mode: scheme; coding: utf-8; -*-
 
-;;;; Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009
+;;;; Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010
 ;;;; Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
@@ -3119,14 +3119,16 @@ module '(ice-9 q) '(make-q q-length))}."
               names)))
 
 (defmacro export names
-  `(call-with-deferred-observers
-    (lambda ()
-      (module-export! (current-module) ',names))))
+  `(eval-when (eval load compile)
+     (call-with-deferred-observers
+      (lambda ()
+        (module-export! (current-module) ',names)))))
 
 (defmacro re-export names
-  `(call-with-deferred-observers
-    (lambda ()
-      (module-re-export! (current-module) ',names))))
+  `(eval-when (eval load compile)
+     (call-with-deferred-observers
+       (lambda ()
+         (module-re-export! (current-module) ',names)))))
 
 (defmacro export-syntax names
   `(export ,@names))
index fb875ccd21984f06c6dbab5e9a9a99db896ccf96..539540c6d2e62f84537e4ec86df3837883f88fd7 100644 (file)
                                       #:opts %opts-w-unused-toplevel))))))
 
      (pass-if "unused but define-public"
-       ;; FIXME: We don't handle this case for now because `define-public'
-       ;; expands to a relatively complex statement that's hard to match.
-       (throw 'unresolved)
-
        (null? (call-with-warnings
                 (lambda ()
                   (compile '(define-public foo 2)