unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* State-of-the-art format string analysis
@ 2010-10-10 17:30 Ludovic Courtès
  2010-10-10 18:40 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2010-10-10 17:30 UTC (permalink / raw)
  To: guile-devel

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’.




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

end of thread, other threads:[~2010-10-10 18:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 17:30 State-of-the-art format string analysis Ludovic Courtès
2010-10-10 18:40 ` Andy Wingo

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).