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

Matt Jordan reviewboard at asterisk.org
Thu Mar 26 20:06:23 CDT 2015



> On March 26, 2015, 12: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).

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.


- Matt


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


On March 26, 2015, 12:52 p.m., Diederik de Groot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4527/
> -----------------------------------------------------------
> 
> (Updated March 26, 2015, 12:52 p.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 433444 
>   /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/b7cbc408/attachment-0001.html>


More information about the asterisk-dev mailing list