unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: Daniel Llorens <daniel.llorens@bluewin.ch>
Cc: "Ludovic Courtès" <ludo@gnu.org>, 13485@debbugs.gnu.org
Subject: bug#13485: wrong warning for format ~!
Date: Sat, 19 Jan 2013 17:24:26 +0000	[thread overview]
Message-ID: <87obglozlh.fsf@Kagami.home> (raw)
In-Reply-To: <87sj5yp404.fsf@Kagami.home> (Ian Price's message of "Fri, 18 Jan 2013 21:36:59 +0000")

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

Ian Price <ianprice90@googlemail.com> writes:

> I'm currently looking through the format docs to see if any others are
> mishandled, and will post a patch later.

So, having went through all of the docs for format, I think I've handled
all of the sequences correctly (except for the iteration ones, which
were already done, and I never double-checked). The two main issues were
sequences that don't take an argument updating the count, and some
sequences were not treated insensitively.

~^ confused me a little, but I think I have the correct behaviour for it

Ludovic,
are there test cases for this? I'm not sure where to look

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: format warnings patch --]
[-- Type: text/x-patch, Size: 1933 bytes --]

From 986181b3b7bd7b6a0814ed45cb606238ab927db3 Mon Sep 17 00:00:00 2001
From: Ian Price <ianprice90@googlemail.com>
Date: Sat, 19 Jan 2013 17:05:27 +0000
Subject: [PATCH] Fix argument count for various format string escape
 sequences.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Handle ~t and ~k options case-insensitively.
  ~! ~| ~/ ~q and ~Q should not update the min-count or max-count.
  ~^ returns the min-count and 'any
---
 module/language/tree-il/analyze.scm |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/module/language/tree-il/analyze.scm b/module/language/tree-il/analyze.scm
index 88f81f3..29dd876 100644
--- a/module/language/tree-il/analyze.scm
+++ b/module/language/tree-il/analyze.scm
@@ -1259,7 +1259,7 @@ accurate information is missing from a given `tree-il' element."
         (case state
           ((tilde)
            (case (car chars)
-             ((#\~ #\% #\& #\t #\_ #\newline #\( #\))
+             ((#\~ #\% #\& #\t #\T #\_ #\newline #\( #\) #\! #\| #\/ #\q #\Q)
                         (loop (cdr chars) 'literal '()
                               conditions end-group
                               min-count max-count))
@@ -1330,10 +1330,12 @@ accurate information is missing from a given `tree-il' element."
                                      min-count)
                                   (+ (or (previous-number params) 1)
                                      max-count))))
-             ((#\? #\k)
+             ((#\? #\k #\K)
               ;; We don't have enough info to determine the exact number
               ;; of args, but we could determine a lower bound (TODO).
               (values 'any 'any))
+             ((#\^)
+              (values min-count 'any))
              ((#\h #\H)
                         (let ((argc (if (memq #\: params) 2 1)))
                           (loop (cdr chars) 'literal '()
-- 
1.7.7.6


  reply	other threads:[~2013-01-19 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 12:09 bug#13485: wrong warning for format ~! Daniel Llorens
2013-01-18 21:36 ` Ian Price
2013-01-19 17:24   ` Ian Price [this message]
2013-01-19 17:45     ` Ian Price
2013-01-19 20:28     ` Ludovic Courtès
2013-01-28 14:36       ` Ian Price
2013-01-28 16:23         ` Ludovic Courtès
2013-03-07 22:24           ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87obglozlh.fsf@Kagami.home \
    --to=ianprice90@googlemail.com \
    --cc=13485@debbugs.gnu.org \
    --cc=daniel.llorens@bluewin.ch \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).