[erlang-questions] Unused inline functions compiler warning

Edwin Fine erlang-questions_efine@REDACTED
Fri Oct 3 21:02:15 CEST 2008


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/2f7a1b9d/attachment.htm>


More information about the erlang-questions mailing list