~ chicken-core (chicken-5) e1e891748a27f5d4b38ce94ae6e4035241df5f24


commit e1e891748a27f5d4b38ce94ae6e4035241df5f24
Author:     felix <bunny351@gmail.com>
AuthorDate: Wed Jun 2 16:50:41 2010 +0200
Commit:     felix <bunny351@gmail.com>
CommitDate: Wed Jun 2 16:50:41 2010 +0200

    don't emit empty inline files and delete if existing; bumped version to 4.5.3

diff --git a/README b/README
index c82f6293..dd048a52 100644
--- a/README
+++ b/README
@@ -6,7 +6,7 @@
   (c) 2008-2010, The Chicken Team
   (c) 2000-2007, Felix L. Winkelmann
 
-  version 4.5.2
+  version 4.5.3
 
 
  1. Introduction
diff --git a/buildversion b/buildversion
index 689f7fbd..ae6e65bd 100644
--- a/buildversion
+++ b/buildversion
@@ -1 +1 @@
-4.5.2
\ No newline at end of file
+4.5.3
\ No newline at end of file
diff --git a/manual/The User's Manual b/manual/The User's Manual
index 6d068fdc..18ad7293 100644
--- a/manual/The User's Manual	
+++ b/manual/The User's Manual	
@@ -6,7 +6,7 @@
 <img style="float:right; border-left:1px solid #ccc;border-bottom:1px solid #ccc;margin-left:1em;" src="http://www.call-with-current-continuation.org/chicken4.png" alt="Stylized picture of a chicken"/>
 </nowiki>
 
-This is the manual for Chicken Scheme, version 4.5.2
+This is the manual for Chicken Scheme, version 4.5.3
 
 ; [[Getting started]] : What is CHICKEN and how do I use it?
 
diff --git a/manual/Using the compiler b/manual/Using the compiler
index b3579064..a618c56a 100644
--- a/manual/Using the compiler	
+++ b/manual/Using the compiler	
@@ -86,7 +86,7 @@ the source text should be read from standard input.
 
 ; -emit-import-library MODULE : Specifies that an import library named {{MODULE.import.scm}} for the named module should be generated (equivalent to using the {{emit-import-library}} declaration).
 
-; -emit-inline-file FILENAME : Write procedures that can be globally inlined in internal form to {{FILENAME}}, if global inlining is enabled. Implies {{-inline -local}}.
+; -emit-inline-file FILENAME : Write procedures that can be globally inlined in internal form to {{FILENAME}}, if global inlining is enabled. Implies {{-inline -local}}. If the inline-file would be empty (because no procedure would be inlinable) no file is generated and any existing inline-file with that name is deleted.
 
 ; -explicit-use : Disables automatic use of the units {{library, eval}} and {{extras}}. Use this option if compiling a library unit instead of an application unit.
 
diff --git a/support.scm b/support.scm
index 057386ce..e44eff9e 100644
--- a/support.scm
+++ b/support.scm
@@ -664,33 +664,40 @@
     (make-node (car x) (cadr x) (map walk (cddr x)))))
 
 (define (emit-global-inline-file filename db)
-  (let ((lst '()))
-    (with-output-to-file filename
-      (lambda ()
-	(print "; GENERATED BY CHICKEN " (chicken-version) " FROM "
-	       source-filename "\n")
-	(##sys#hash-table-for-each
-	 (lambda (sym plist)
-	   (when (variable-visible? sym)
-	     (and-let* ((val (assq 'local-value plist))
-			((not (node? (variable-mark sym '##compiler#inline-global))))
-			((let ((val (assq 'value plist)))
-			   (or (not val)
-			       (not (eq? 'unknown (cdr val))))))
-			((assq 'inlinable plist))
-			(lparams (node-parameters (cdr val)))
-			;;((get db (first lparams) 'simple)) 
-			((not (get db sym 'hidden-refs)))
-			((case (variable-mark sym '##compiler#inline)
-			   ((yes) #t)
-			   ((no) #f)
-			   (else 
-			    (< (fourth lparams) inline-max-size) ) ) ) )
-	       (set! lst (cons sym lst))
-	       (pp (list sym (node->sexpr (cdr val))))
-	       (newline))))
-	 db)
-	(print "; END OF FILE")))
+  (let ((lst '())
+	(out '()))
+    (##sys#hash-table-for-each
+     (lambda (sym plist)
+       (when (variable-visible? sym)
+	 (and-let* ((val (assq 'local-value plist))
+		    ((not (node? (variable-mark sym '##compiler#inline-global))))
+		    ((let ((val (assq 'value plist)))
+		       (or (not val)
+			   (not (eq? 'unknown (cdr val))))))
+		    ((assq 'inlinable plist))
+		    (lparams (node-parameters (cdr val)))
+		    ;;((get db (first lparams) 'simple)) 
+		    ((not (get db sym 'hidden-refs)))
+		    ((case (variable-mark sym '##compiler#inline)
+		       ((yes) #t)
+		       ((no) #f)
+		       (else 
+			(< (fourth lparams) inline-max-size) ) ) ) )
+	   (set! lst (cons sym lst))
+	   (set! out (cons (list sym (node->sexpr (cdr val))) out)))))
+     db)
+    (if (null? out)
+	(delete-file* filename)
+	(with-output-to-file filename
+	  (lambda ()
+	    (print "; GENERATED BY CHICKEN " (chicken-version) " FROM "
+		   source-filename "\n")
+	    (for-each
+	     (lambda (x)
+	       (pp x)
+	       (newline))
+	     (reverse out))
+	    (print "; END OF FILE"))))
     (when (and (pair? lst)
 	       (debugging 'i "the following procedures can be globally inlined:"))
       (for-each (cut print "  " <>) (sort-symbols lst)))))
diff --git a/version.scm b/version.scm
index e6ababe5..2767a9ae 100644
--- a/version.scm
+++ b/version.scm
@@ -1 +1 @@
-(define-constant +build-version+ "4.5.2")
+(define-constant +build-version+ "4.5.3")
Trap