mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-20 02:30:23 +02:00
Handle ~p in 'format' warnings.
Fixes <http://bugs.gnu.org/18299>. Reported by Frank Terbeck <ft@bewatermyfriend.org>. * module/language/tree-il/analyze.scm (format-string-argument-count): Add case for ~p. * test-suite/tests/tree-il.test ("warnings")["format"]("~p", "~p, too few arguments", "~:p", "~:@p, too many arguments", "~:@p, too few arguments"): New tests.
This commit is contained in:
parent
c6a7930b38
commit
8ac39b38d1
2 changed files with 56 additions and 1 deletions
|
@ -1698,6 +1698,50 @@
|
|||
(number? (string-contains (car w)
|
||||
"expected 3, got 2")))))
|
||||
|
||||
(pass-if "~p"
|
||||
(null? (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '(((@ (ice-9 format) format) #f "thing~p" 2))
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
|
||||
(pass-if "~p, too few arguments"
|
||||
(let ((w (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '((@ (ice-9 format) format) #f "~p")
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
(and (= (length w) 1)
|
||||
(number? (string-contains (car w)
|
||||
"expected 1, got 0")))))
|
||||
|
||||
(pass-if "~:p"
|
||||
(null? (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '(((@ (ice-9 format) format) #f "~d thing~:p" 2))
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
|
||||
(pass-if "~:@p, too many arguments"
|
||||
(let ((w (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '((@ (ice-9 format) format) #f "~d pupp~:@p" 5 5)
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
(and (= (length w) 1)
|
||||
(number? (string-contains (car w)
|
||||
"expected 1, got 2")))))
|
||||
|
||||
(pass-if "~:@p, too few arguments"
|
||||
(let ((w (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '((@ (ice-9 format) format) #f "pupp~:@p")
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
(and (= (length w) 1)
|
||||
(number? (string-contains (car w)
|
||||
"expected 1, got 0")))))
|
||||
|
||||
(pass-if "~?"
|
||||
(null? (call-with-warnings
|
||||
(lambda ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue