unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#18299: Analyzer issues warning with ~:p expansion of ‘format’
@ 2014-08-20 12:26 Frank Terbeck
  2014-08-26 21:42 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Terbeck @ 2014-08-20 12:26 UTC (permalink / raw)
  To: 18299

Hello Guile developers,

I was trying this:

  (use-modules (ice-9 format))
  (format #t "~d block~:p~%" 1)   ;; and 0, and 2 etc...
  
This triggers a warning about the format-string argument count:

  ;;; <stdin>:3:0: warning: "~d block~:p~%": wrong number of `format'
      arguments: expected 2, got 1

The manual says this about "~:p":

  ~:p re-uses the preceding argument instead of taking a new
  one, which can be convenient when printing some sort of count.

      (format #t "~d cat~:p" 9)   ⊣ 9 cats
      (format #t "~d pupp~:@p" 5) ⊣ 5 puppies

I was looking at the code, and it appears that the warning is triggered
in "module/language/tree-il/analyze.scm" in ‘format-analysis’ and more
precisely in ‘check-format-args’, due to the lack of support for "~:p"
and presumably "~:@p" in ‘format-string-argument-count’.


Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#18299: Analyzer issues warning with ~:p expansion of ‘format’
  2014-08-20 12:26 bug#18299: Analyzer issues warning with ~:p expansion of ‘format’ Frank Terbeck
@ 2014-08-26 21:42 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2014-08-26 21:42 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: 18299-done

Frank Terbeck <ft@bewatermyfriend.org> skribis:

> I was trying this:
>
>   (use-modules (ice-9 format))
>   (format #t "~d block~:p~%" 1)   ;; and 0, and 2 etc...
>   
> This triggers a warning about the format-string argument count:
>
>   ;;; <stdin>:3:0: warning: "~d block~:p~%": wrong number of `format'
>       arguments: expected 2, got 1

I believe commit 8ac39b3 fixes it.  It will be in 2.0.12.

Thanks!

Ludo’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-26 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 12:26 bug#18299: Analyzer issues warning with ~:p expansion of ‘format’ Frank Terbeck
2014-08-26 21:42 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).