1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

Merge remote-tracking branch 'origin/stable-2.0'

This commit is contained in:
Andy Wingo 2012-03-02 17:46:52 +01:00
commit dee4e3ee3c
2 changed files with 18 additions and 21 deletions

View file

@ -1358,16 +1358,16 @@ accurate information is missing from a given `tree-il' element."
resort, return #t when EXP refers to the global variable SPECIAL-NAME." resort, return #t when EXP refers to the global variable SPECIAL-NAME."
(match exp (match exp
(($ <toplevel-ref> _ name) (($ <toplevel-ref> _ name)
(let ((var (false-if-exception (module-variable env name)))) (let ((var (module-variable env name)))
(if var (if (and var (variable-bound? var))
(eq? (false-if-exception (variable-ref var)) ; VAR may be unbound (eq? (variable-ref var) proc)
proc) (eq? name special-name)))) ; special hack to support local aliases
(eq? name special-name)))) ; special hack to support local aliases
(($ <module-ref> _ module name public?) (($ <module-ref> _ module name public?)
(let ((m (false-if-exception (if public? (let* ((mod (if public?
(resolve-interface module) (false-if-exception (resolve-interface module))
(resolve-module module))))) (resolve-module module #:ensure? #f)))
(and m (eq? (false-if-exception (module-ref module name)) proc)))) (var (and mod (module-variable mod name))))
(and var (variable-bound? var) (eq? (variable-ref var) proc))))
(_ #f))) (_ #f)))
(define gettext? (cut proc-ref? <> gettext '_ <>)) (define gettext? (cut proc-ref? <> gettext '_ <>))

View file

@ -2234,18 +2234,15 @@
#:opts %opts-w-format #:opts %opts-w-format
#:to 'assembly))))) #:to 'assembly)))))
(pass-if "non-literal format string with forward declaration" (pass-if "non-literal format string with (define _ gettext)"
(let ((w (call-with-warnings (null? (call-with-warnings
(lambda () (lambda ()
(compile '(begin (compile '(begin
(define (foo) (define _ gettext)
(format #t (_ "~A ~A!") "hello" "world")) (define (foo)
(define _ bar)) (format #t (_ "~A ~A!") "hello" "world")))
#:opts %opts-w-format #:opts %opts-w-format
#:to 'assembly))))) #:to 'assembly)))))
(and (= (length w) 1)
(number? (string-contains (car w)
"non-literal format string")))))
(pass-if "wrong format string" (pass-if "wrong format string"
(let ((w (call-with-warnings (let ((w (call-with-warnings