~ chicken-core (chicken-5) 0710fa98e976d7333b3448c7a35f7dfcd43b674a


commit 0710fa98e976d7333b3448c7a35f7dfcd43b674a
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Tue Dec 29 08:38:49 2015 +1300
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Tue Dec 29 13:03:50 2015 +0100

    Don't warn about unused hidden variables
    
    Fixes #1237.
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/compiler-namespace.scm b/compiler-namespace.scm
index 1bbbcdf1..1df475f2 100644
--- a/compiler-namespace.scm
+++ b/compiler-namespace.scm
@@ -298,6 +298,7 @@
  valid-compiler-options
  valid-compiler-options-with-argument
  validate-type
+ variable-hidden?
  variable-mark
  variable-visible?
  varnode
diff --git a/compiler.scm b/compiler.scm
index 55dbda68..c706942a 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -2054,6 +2054,7 @@
 		    global
 		    (null? references)
 		    (not (variable-mark sym '##compiler#unused))
+		    (not (variable-hidden? sym))
 		    (not (variable-visible? sym))
 		    (not (variable-mark sym '##compiler#constant)) )
 	   (##sys#notice 
diff --git a/support.scm b/support.scm
index 1c487827..5196a17b 100644
--- a/support.scm
+++ b/support.scm
@@ -1588,6 +1588,9 @@
 (define (export-variable sym)
   (mark-variable sym '##compiler#visibility 'exported))
 
+(define (variable-hidden? sym)
+  (eq? (##sys#get sym '##compiler#visibility) 'hidden))
+
 (define (variable-visible? sym)
   (let ((p (##sys#get sym '##compiler#visibility)))
     (case p
Trap