[erlang-questions] Unused inline functions compiler warning

Bjorn Gustavsson <>
Sun Oct 5 08:32:38 CEST 2008


2008/10/3 Edwin Fine <>

> Does this imply that every inline function in a .hrl file will be inserted
> into every single .erl file that includes it, even if it is unused? If not,
> then why have a compiler warning?
>

No, the compiler will always remove unused local functions.

The compiler always warns for unused functions, to help you get rid of old
functions that are no longer used.

I suppose it could be reasonable if the compiler suppressed the warning for
functions that are defined in .hrl files
(in the same way that it only warns for unused records in .erl files, never
in .hrl files). If there are no strong objections
either here or in the Erlang/OTP group, we might change that for R12B-5
release.


>
> Is there any way to overcome this without reverting back to using macros?
>
> Can I get rid of just those warnings? Is there a way to suppress warnings
> for individual functions, like a -compile({suppress, [{wunused,
> [{log_info,3},{log_dbg,3}]}]})?
>
> There is currently no way to suppress individual warnings. We have been
thinking about adding such a mechanism.

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081005/1f91fdc3/attachment.html>


More information about the erlang-questions mailing list