guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-142-g4c984


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-142-g4c98474
Date: Sat, 12 May 2012 13:32:50 +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".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=4c98474782d11ad02046c87af148e29d14afbc29

The branch, stable-2.0 has been updated
       via  4c98474782d11ad02046c87af148e29d14afbc29 (commit)
      from  da874e5415f2d9438e66b9989086465b6cbf578c (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 4c98474782d11ad02046c87af148e29d14afbc29
Author: Ludovic Courtès <address@hidden>
Date:   Sat May 12 15:31:28 2012 +0200

    Improve special-casing of `_' in `-Wformat'.
    
    * module/language/tree-il/analyze.scm (proc-ref?): Check for
      SPECIAL-NAME in the <module-ref> and <lexical-ref> cases too.
    
    * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
      format string using gettext as module-ref _", "non-literal format
      string using gettext as lexical _"): New tests.

-----------------------------------------------------------------------

Summary of changes:
 module/language/tree-il/analyze.scm |    8 ++++++--
 test-suite/tests/tree-il.test       |   16 ++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/module/language/tree-il/analyze.scm 
b/module/language/tree-il/analyze.scm
index 1fd8d58..76923fc 100644
--- a/module/language/tree-il/analyze.scm
+++ b/module/language/tree-il/analyze.scm
@@ -1359,9 +1359,13 @@ resort, return #t when EXP refers to the global variable 
SPECIAL-NAME."
     (($ <module-ref> _ module name public?)
      (let* ((mod (if public?
                      (false-if-exception (resolve-interface module))
-                     (resolve-module module #:ensure? #f)))
+                     (resolve-module module #:ensure #f)))
             (var (and mod (module-variable mod name))))
-       (and var (variable-bound? var) (eq? (variable-ref var) proc))))
+       (if var
+           (and (variable-bound? var) (eq? (variable-ref var) proc))
+           (eq? name special-name))))
+    (($ <lexical-ref> _ (? (cut eq? <> special-name)))
+     #t)
     (_ #f)))
 
 (define gettext? (cut proc-ref? <> gettext '_ <>))
diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test
index 2b07e62..28c0b26 100644
--- a/test-suite/tests/tree-il.test
+++ b/test-suite/tests/tree-il.test
@@ -1242,6 +1242,22 @@
                           #:opts %opts-w-format
                           #:to 'assembly)))))
 
+     (pass-if "non-literal format string using gettext as module-ref _"
+       (null? (call-with-warnings
+               (lambda ()
+                 (compile '(format #t ((@@ (foo) _) "~A ~A!") "hello" "world")
+                          #:opts %opts-w-format
+                          #:to 'assembly)))))
+
+     (pass-if "non-literal format string using gettext as lexical _"
+       (null? (call-with-warnings
+               (lambda ()
+                 (compile '(let ((_ (lambda (s)
+                                      (gettext s "my-domain"))))
+                             (format #t (_ "~A ~A!") "hello" "world"))
+                          #:opts %opts-w-format
+                          #:to 'assembly)))))
+
      (pass-if "non-literal format string using ngettext"
        (null? (call-with-warnings
                (lambda ()


hooks/post-receive
-- 
GNU Guile



reply via email to

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