guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

State-of-the-art format string analysis


From: Ludovic Courtès
Subject: State-of-the-art format string analysis
Date: Sun, 10 Oct 2010 19:30:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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 address@hidden")
<stdin>:14:3: warning: "~A address@hidden": 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 via email to

[Prev in Thread] Current Thread [Next in Thread]