warn_unused_vars

Happi <>
Sat Feb 1 01:57:33 CET 2003


I think Richard C. or Björn G. can explain this better...
... but I'll give it a try, and they can fill in the blanks
and correct my errors.


The problem comes from the order in which things are done
in the compiler.

The compile options in the file are not parsed until
after the linter is executed -- hence the linter
will not see the warn_unused_vars flag.

To get around this problem I have set
ERL_COMPILER_OPTIONS
to
'[warn_unused_vars,nowarn_shadow_vars]'
in my unix-shell.


There are several strange things with the order in which the
compiler does things, and the fact that you can give compiler
options in several different places, but that let's not start
that thread, nor the thread about the linter and the macro expander.

-Erik
--------------------------------------
I'm Happi, you should be happy.
Praeterea censeo "0xCA" scribere Erlang posse.


----- Original Message -----
From: "Ulf Wiger" <>
To: <>
Sent: Friday, January 31, 2003 5:11 PM
Subject: warn_unused_vars


>
> Can someone explain this?
>
> 1> c(leader).
> {ok,leader}
> 2> leader:module_info(compile).
> [{options,[v3,warn_unused_vars]},
>  {version,"4.1.1"},
>  {time,{2003,1,31,16,5,57}}]
> 3> c(leader,[warn_unused_vars]).
> ./leader.erl:126: Warning: variable 'From' is unused
> {ok,leader}
> 4> leader:module_info(compile).
> [{options,[v3,warn_unused_vars,warn_unused_vars]},
>  {version,"4.1.1"},
>  {time,{2003,1,31,16,6,16}}]
>
>
> That is, I've added '-compile(warn_unused_vars)' in the
> source code, but the linter seems to ignore that. With
> module_info, I can see that the compile option is there. I
> don't get any warning unless I add 'warn_unused_vars' as an
> explicit option to compile, though.
>
> I looked briefly at compile.erl, but I'd rather that someone
> who knows the code take a look. It's not the simplest module
> in the OTP distribution.
>
>
> This is compiler-4.1.1 (OTP R9B)
>
> /Uffe
> --
> Ulf Wiger, Senior Specialist,
>    / / /   Architecture & Design of Carrier-Class Software
>   / / /    Strategic Product & System Management
>  / / /     Ericsson Telecom AB, ATM Multiservice Networks
>
>




More information about the erlang-questions mailing list