[asterisk-dev] [Code Review] 4527: clang compiler warning: -Wunused-function

Diederik de Groot reviewboard at asterisk.org
Fri Mar 27 05:47:02 CDT 2015



> On March 26, 2015, 6:52 p.m., Diederik de Groot wrote:
> > /branches/13/channels/chan_iax2.c, lines 2026-2032
> > <https://reviewboard.asterisk.org/r/4527/diff/1/?file=72928#file72928line2026>
> >
> >     user_ref function not being used, may/might actually indicate a refcount issue.
> >     Because of the simple nature of these two functions, they could as well be implemented using 
> >     #define user_ref(_USER) ao2_ref(_USER, +1)
> >     #define user_unref(_USER) ao2_ref(_USER, -1)
> >     instead. Which would not have generated this unused warning, and after compilation they would both result in the same code (inline).
> 
> Matt Jordan wrote:
>     It doesn't necessarily indicate a ref count issue. Having a wrapper around the ao2 calls is useful when you have a particular tag you always to apply, or some additional debugging - but the fact that it isn't being used isn't necessarily indicative of a coding error elsewhere.
>     
>     I'd just remove this, since it isn't being used. If chan_iax2 ends up needing a user_ref wrapper, then we can always add something like it at a future date.

That's why i used the word 'may/might' ;-) I have not checked all of the refs/unrefs to see if there actually was an issue. And because it is in chan_iax2.c chances would be pretty low, that there is/was one.


- Diederik


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4527/#review14856
-----------------------------------------------------------


On March 27, 2015, 11:46 a.m., Diederik de Groot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4527/
> -----------------------------------------------------------
> 
> (Updated March 27, 2015, 11:46 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24917
>     https://issues.asterisk.org/jira/browse/ASTERISK-24917
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> clang's static analyzer will throw quite a number warnings / errors during compilation, some of which can be very helpfull in finding corner-case bugs
> clang compiler warning:-Wunused-function
> 
> 
> Diffs
> -----
> 
>   /branches/13/main/dsp.c 433444 
>   /branches/13/main/config.c 433470 
>   /branches/13/channels/chan_iax2.c 433444 
> 
> Diff: https://reviewboard.asterisk.org/r/4527/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Diederik de Groot
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150327/b4eed462/attachment.html>


More information about the asterisk-dev mailing list