caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pixel <pixel@mandrakesoft.com>
To: caml-list@inria.fr
Subject: [Caml-list] Re: unused variables warning
Date: 09 Sep 2002 23:24:09 +0200	[thread overview]
Message-ID: <lyy9aahn5y.fsf@leia.mandrakesoft.com> (raw)
In-Reply-To: <20010428095737.206C55722@leia.mandrakesoft.com>

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

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
auto-generated).
- 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:
http://people.mandrakesoft.com/~prigaux/ocaml-3.06-add-warning-for-unused-local-variables.patch

The tool on ocaml 3.04:
http://people.mandrakesoft.com/~prigaux/warn_unused.make
http://people.mandrakesoft.com/~prigaux/warn_unused.ml


(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


      parent reply	other threads:[~2002-09-09 21:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-28  9:57 [Caml-list] " Pixel
2001-04-29  8:15 ` Vitaly Lugovsky
2001-04-29  9:58   ` Pixel
2001-04-29 13:06     ` Sven LUTHER
2001-04-29 13:14       ` Pixel
2001-04-29 10:14   ` Marcin 'Qrczak' Kowalczyk
2002-09-09 21:24 ` Pixel [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lyy9aahn5y.fsf@leia.mandrakesoft.com \
    --to=pixel@mandrakesoft.com \
    --cc=caml-list@inria.fr \
    /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 NNTP newsgroup(s).