mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
don't warn for (format #t fmt) -- format string actually named fmt
* module/language/tree-il/analyze.scm (format-analysis): Don't warn on non-literal format string if the format string is a lexical ref to a variable named "fmt". A slight hack, but effective :) * module/system/repl/command.scm (display-stat): Rename the format string to "fmt".
This commit is contained in:
parent
a36c3a458e
commit
5414d33376
2 changed files with 9 additions and 3 deletions
|
@ -1369,7 +1369,13 @@ accurate information is missing from a given `tree-il' element."
|
|||
(warning 'format loc 'syntax-error key fmt)))
|
||||
(warning 'format loc 'wrong-format-string fmt))))
|
||||
((,port ,fmt . ,rest)
|
||||
(warning 'format loc 'non-literal-format-string))
|
||||
;; Warn on non-literal format strings, unless they refer to a
|
||||
;; lexical variable named "fmt".
|
||||
(if (record-case fmt
|
||||
((<lexical-ref> name)
|
||||
(not (eq? name 'fmt)))
|
||||
(else #t))
|
||||
(warning 'format loc 'non-literal-format-string)))
|
||||
(else
|
||||
(warning 'format loc 'wrong-num-args (length args)))))
|
||||
|
||||
|
|
|
@ -838,8 +838,8 @@ Display statistics."
|
|||
(set! (repl-gc-stats repl) this-gcs)))
|
||||
|
||||
(define (display-stat title flag field1 field2 unit)
|
||||
(let ((str (format #f "~~20~AA ~~10@A /~~10@A ~~A~~%" (if flag "" "@"))))
|
||||
(format #t str title field1 field2 unit)))
|
||||
(let ((fmt (format #f "~~20~AA ~~10@A /~~10@A ~~A~~%" (if flag "" "@"))))
|
||||
(format #t fmt title field1 field2 unit)))
|
||||
|
||||
(define (display-stat-title title field1 field2)
|
||||
(display-stat title #t field1 field2 ""))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue