1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +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:
Ludovic Courtès 2014-08-26 23:40:22 +02:00
parent c6a7930b38
commit 8ac39b38d1
2 changed files with 56 additions and 1 deletions

View file

@ -1,6 +1,7 @@
;;; TREE-IL -> GLIL compiler
;; Copyright (C) 2001, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2008, 2009, 2010, 2011, 2012,
;; 2014 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -1273,6 +1274,16 @@ accurate information is missing from a given `tree-il' element."
conditions end-group
(+ 1 min-count)
(+ 1 max-count)))
((#\p #\P) (let* ((colon? (memq #\: params))
(min-count (if colon?
(max 1 min-count)
(+ 1 min-count))))
(loop (cdr chars) 'literal '()
conditions end-group
min-count
(if colon?
(max max-count min-count)
(+ 1 max-count)))))
((#\[)
(loop chars 'literal '() '()
(let ((selector (previous-number params))