Yep, but exporting it all over is just code-cruft. I'd like to avoid it if possible.<div><br><br><div class="gmail_quote">On Mon, Apr 11, 2011 at 3:27 PM, James Churchman <span dir="ltr"><<a href="mailto:jameschurchman@gmail.com">jameschurchman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">> Unused function warning :<br>
<br>
<br>
As a dirty hack, you could export the function that it's complaining about. That will solve the problem.<br>
<br>
The other option I can think of is to make a parse transform that removes the function. You could set an attribute like -remove([{ data_conn_make_inet_link,4 }), read it in a config file, hard code the fun/arity into the PT etc.. and then filter the AST before it gets parsed into the config file so thats its removed before the final compile. I assume that will remove the warning. I could code it for you if you like..<br>
<br>
> "void"<br>
<br>
As far as my understanding, just placing 'ok' atom at the end of the function it the standard. I think that the overhead of doing this is so minuscule you will never notice. Altho having a void may sound a neat idea it would break erlang. Erlang always has defined behaviour under all circumstances, with this "void" under a buggy piece of code, that accidentally sets a var from your void function, there would either need to be a new type of error thrown, or worse still erlang would behave in an unpredictable manor. Erlang is designed to have predictable behaviour even under faulty erlang code :-)<br>
<br>
<br>
James<br>
<div><div></div><div class="h5"><br>
<br>
On 11 Apr 2011, at 23:09, Mike Oxford wrote:<br>
<br>
> Unused function warning<br>
> =====================================<br>
> data_conn_make_inet_link(SrcIP, SrcPort, DstIP, DstPort) -><br>
> #inet_link{ src=#inet_src{ip=SrcIP, port=SrcPort}, dst=#inet_dst{ip=DstIP, port=DstPort}}.<br>
><br>
> I want to put this in a "common header," but not every single file which uses the header will use<br>
> this particular call.<br>
><br>
> It's old getting spammed with warnings about this.<br>
> It's poor to have to turn off warnings at a global level.<br>
><br>
> May I propose prepending something to suppress warning about it not being used? Maybe<br>
> using a leading "-"? or %ifdef/#ifdef#pragma-style preprocessor controls? -quiet-include("file"). ?<br>
><br>
> -method()-> %% ignore "unused" warnings<br>
><br>
> I see some discussion of this back around 2008, but I don't see any traction on it since. Anyone<br>
> know if this was ever implemented in any form?<br>
><br>
><br>
><br>
> "void"<br>
> =====================================<br>
> If I do not care about the return value of a method, can I do something to tell that to the compiler?<br>
> No reason to allocate return storage on the frame if I don't care about it anyway? Or is this too trivial<br>
> in the scope of "Erlang copies everything everywhere" to be of consideration?<br>
><br>
> _method()-> %% don't allocate storage or worry about returns<br>
><br>
><br>
> Thanks!<br>
><br>
> -mox<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
</blockquote></div><br></div>