unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: State-of-the-art format string analysis
Date: Sun, 10 Oct 2010 19:30:04 +0200	[thread overview]
Message-ID: <874ocuhs6b.fsf@gnu.org> (raw)

Hello Guilers!

I’m proud to announce that Guile’s compiler now comes with
state-of-the-art format string static analysis™.

Initially, I thought ‘format’ was about ~A, ~S, ~f, and various obscure
flags that nobody really uses, until I found (thanks to our ‘format’
wizard—you know who you are) that (1) these obscure options are actually
used and useful, and (2) the ‘format’ language is on par with Brainfuck.

So, a few examples:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,o compile-options (#:warnings (unbound-variable arity-mismatch format))
scheme@(guile-user)> ,c (format 100 "~a")
<stdin>:9:3: warning: 100: wrong port argument
<stdin>:9:3: warning: "~a": wrong number of `format' arguments: expected 1, got 0
[...]

scheme@(guile-user)> ,c (format #f "~[chbouib~;~a~;~2*~a~]")
<stdin>:11:0: warning: "~[chbouib~;~a~;~2*~a~]": wrong number of `format' arguments: expected 1 to 4, got 0
[...]

scheme@(guile-user)> ,c (format #f "~A ~@{~S~}")
<stdin>:14:3: warning: "~A ~@{~S~}": wrong number of `format' arguments: expected at least 1, got 0
[...]

scheme@(guile-user)> ,c (format #f "~[")
<stdin>:16:0: warning: "~[": unterminated conditional
[...]
--8<---------------cut here---------------end--------------->8---

Comments welcome!

Ludo’.




             reply	other threads:[~2010-10-10 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-10 17:30 Ludovic Courtès [this message]
2010-10-10 18:40 ` State-of-the-art format string analysis 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=874ocuhs6b.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@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).