[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-62-gd31604

From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-62-gd316047
Date: Sun, 26 Feb 2012 23:51:17 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  d316047326fde9d63ca52c0051fbf09124ef297e (commit)
      from  a850c3ccc4bebe07dba2298c5ed0bc86bb64f172 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d316047326fde9d63ca52c0051fbf09124ef297e
Author: Ludovic Courtès <address@hidden>
Date:   Mon Feb 27 00:51:09 2012 +0100

    Avoid failure when `format-analysis' stumbles upon unbound variables.
    * module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref'
      in `false-if-exception'.
    * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
      format string with forward declaration"): New test.


Summary of changes:
 module/language/tree-il/analyze.scm |    3 ++-
 test-suite/tests/tree-il.test       |   13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/module/language/tree-il/analyze.scm 
index 9e6952e..5f995b6 100644
--- a/module/language/tree-il/analyze.scm
+++ b/module/language/tree-il/analyze.scm
@@ -1354,7 +1354,8 @@ resort, return #t when EXP refers to the global variable 
     (($ <toplevel-ref> _ name)
      (let ((var (false-if-exception (module-variable env name))))
        (if var
-           (eq? (variable-ref var) proc)
+           (eq? (false-if-exception (variable-ref var)) ; VAR may be unbound
+                proc)
            (eq? name special-name))))      ; special hack to support local 
     (($ <module-ref> _ module name public?)
      (let ((m (false-if-exception (if public?
diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test
index 945b236..c4966b3 100644
--- a/test-suite/tests/tree-il.test
+++ b/test-suite/tests/tree-il.test
@@ -2184,6 +2184,19 @@
                           #:opts %opts-w-format
                           #:to 'assembly)))))
+     (pass-if "non-literal format string with forward declaration"
+       (let ((w (call-with-warnings
+                 (lambda ()
+                   (compile '(begin
+                               (define (foo)
+                                 (format #t (_ "~A ~A!") "hello" "world"))
+                               (define _ bar))
+                            #:opts %opts-w-format
+                            #:to 'assembly)))))
+         (and (= (length w) 1)
+              (number? (string-contains (car w)
+                                        "non-literal format string")))))
      (pass-if "wrong format string"
        (let ((w (call-with-warnings
                  (lambda ()

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]