Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
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 "", 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 Archives:
Bug reports: FAQ:
Beginner's list: