GNU bug report logs - #18299
Analyzer issues warning with ~:p expansion of ‘format’

Previous Next

Package: guile;

Reported by: Frank Terbeck <ft <at> bewatermyfriend.org>

Date: Wed, 20 Aug 2014 12:31:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18299 in the body.
You can then email your comments to 18299 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#18299; Package guile. (Wed, 20 Aug 2014 12:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frank Terbeck <ft <at> bewatermyfriend.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 20 Aug 2014 12:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frank Terbeck <ft <at> bewatermyfriend.org>
To: bug-guile <at> gnu.org
Subject: Analyzer issues warning with ~:p expansion of ‘format’
Date: Wed, 20 Aug 2014 14:26:34 +0200
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




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Tue, 26 Aug 2014 21:43:02 GMT) Full text and rfc822 format available.

Notification sent to Frank Terbeck <ft <at> bewatermyfriend.org>:
bug acknowledged by developer. (Tue, 26 Aug 2014 21:43:03 GMT) Full text and rfc822 format available.

Message #10 received at 18299-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Frank Terbeck <ft <at> bewatermyfriend.org>
Cc: 18299-done <at> debbugs.gnu.org
Subject: Re: bug#18299: Analyzer issues warning with ~:p expansion of
 ‘format’
Date: Tue, 26 Aug 2014 23:42:22 +0200
Frank Terbeck <ft <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 24 Sep 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.