[erlang-questions] Unused inline functions compiler warning - solved

Edwin Fine erlang-questions_efine@REDACTED
Sat Oct 4 00:00:46 CEST 2008


Please ignore this. I didn't RTFM properly so I missed the
{nowarn_unused_function,
FAs} in the compile  module documentation.

For the record, *unused inline functions are inserted into the module if
compile([export_all]) is defined*, but not if functions are exported
individually. This is hinted at indirectly in the documentation about inline
functions:

"When a function is inlined, the original function may be kept as a separate
function as well, because there might still be calls to it."

On Fri, Oct 3, 2008 at 3:02 PM, Edwin Fine
<erlang-questions_efine@REDACTED>wrote:

> I'm trying to convert my code base from using macros for logging to using
> inline functions, as advocated by Richard O'Keefe.
>
> In an include (.hrl) file, I have inline function definitions like
>
> -compile({inline, [{log_info,3}, ...]).
>
> log_info(Line, Fmt, Args) ->
>     ok = . %% Some code
> ...
>
> However, if I include this file and don't use all of the inline functions,
> I get a compiler warning for each unused function:
>
> warning:function ilog_error/3 is unused
> ... and more
>
> 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?
>
> 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}]}]})?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081003/87861ce3/attachment.htm>


More information about the erlang-questions mailing list