~ chicken-core (chicken-5) 34bf9cc6cc62443d01cdf72d2e04915beb6d6aa5


commit 34bf9cc6cc62443d01cdf72d2e04915beb6d6aa5
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Jun 12 14:32:16 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat Jun 12 14:32:16 2010 +0200

    optimizer emits notice if pure standard/extended binding procedure ain't used

diff --git a/optimizer.scm b/optimizer.scm
index 8ad7a2ba..e3233438 100644
--- a/optimizer.scm
+++ b/optimizer.scm
@@ -301,11 +301,15 @@
 					       (and (not (test (car llist) 'references))
 						    (not (test (car llist) 'assigned)))))
 					  ((not (any (cut expression-has-side-effects? <> db) (cdr args) ))))
-				 (debugging 
-				  'o
-				  "removed call to pure procedure with unused result"
-				  (or (source-info->string (and (pair? (cdr params)) (second params)))
-				      var))
+				 (let ((info (and (pair? (cdr params)) (second params))))
+				   (debugging 
+				    'o
+				    "removed call to pure procedure with unused result"
+				    (or (source-info->string info) var))
+				   (when (and (list? info) (memq pb '(standard extended)))
+				     (##sys#notice
+				      (sprintf "result of call to pure ~a procedure is not used: ~a"
+					pb (source-info->string info)))))
 				 (make-node
 				  '##core#call '(#t)
 				  (list k (make-node '##core#undefined '() '())) ) ) 
Trap