English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] unused variables warning
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-09 (21:26)
From: Pixel <pixel@m...>
Subject: [Caml-list] Re: unused variables warning
I've asked the following question one year ago:

> Is there any way to ask ocamlc for an "unused variable" warning?
> let f x =
>    let x' = <...> in
>    x
> would issue something like
> File "test.ml", line 2, characters 3-18:
> Unused variable x'

I got an answer from Pascal Brisset sending me a nice incomplete piece
of code doing this. After a small adaptation, I've been using it with

When "updating" it to 3.06, i tried to integrate in mandrake's package
to ease my use of it:
- i've added it when all warnings are enabled (-w A)
- it's quite ugly, i've added the various things to make it compile on
3.06 without knowing what should be done. At least it somewhat works :)
- i've dropped a functionality from Pascal Brisset's tool: it only
checks local variables, not modules variables&functions. It was easier
for me and does the checks I need (since my .mli are mostly
- the comments from Pascal Brisset still apply
  - it is uncomplete (it does not handle local modules ...)
  - warning are not issued for identifiers starting with an underscore.

So if it interests someone :)

The patch on ocaml 3.06:

The tool on ocaml 3.04:

(special thanks to Pascal Brisset of course)
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners