[asterisk-dev] [Code Review] 4547: clang compiler warning: braces-around-scalar-initializer

Matt Jordan reviewboard at asterisk.org
Sat Mar 28 09:59:50 CDT 2015


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



/branches/13/channels/chan_iax2.c
<https://reviewboard.asterisk.org/r/4547/#comment25554>

    I really dislike this warning.
    
    In C, it has always been perfectly valid to initialize all members of a struct using { 0 } as a universal zero-initializer. This nomenclature actually makes it less readable, as it makes it look like we only wanted to initialize the .frametype member, and ignored the rest. That may not be the actual effect, but the syntax here is not clearer by any stretch.
    
    :-(
    
    Interestingly, when compiling with clang 3.4, I don't get this warning issued. What version are you compiling with? And what do you think about simply ignoring this warning?


- Matt Jordan


On March 27, 2015, 1:34 p.m., Diederik de Groot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4547/
> -----------------------------------------------------------
> 
> (Updated March 27, 2015, 1:34 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:braces-around-scalar-initializer
> 
> 
> Diffs
> -----
> 
>   /branches/13/res/res_pjsip_dtmf_info.c 433444 
>   /branches/13/channels/sig_ss7.c 433444 
>   /branches/13/channels/sig_pri.c 433444 
>   /branches/13/channels/pjsip/dialplan_functions.c 433444 
>   /branches/13/channels/console_gui.c 433444 
>   /branches/13/channels/chan_unistim.c 433444 
>   /branches/13/channels/chan_skinny.c 433444 
>   /branches/13/channels/chan_sip.c 433444 
>   /branches/13/channels/chan_oss.c 433444 
>   /branches/13/channels/chan_mgcp.c 433444 
>   /branches/13/channels/chan_iax2.c 433444 
>   /branches/13/channels/chan_dahdi.c 433444 
>   /branches/13/channels/chan_console.c 433444 
>   /branches/13/channels/chan_alsa.c 433444 
>   /branches/13/apps/app_dictate.c 433444 
> 
> Diff: https://reviewboard.asterisk.org/r/4547/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Diederik de Groot
> 
>

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


More information about the asterisk-dev mailing list