← Back to team overview

kicad-developers team mailing list archive

Re: Coverity finds an ugly bug in wxWidgets

 

We could also just require them on if/then/else statements….

> On 12 Jan 2020, at 00:35, Jeff Young <jeff@xxxxxxxxx> wrote:
> 
> Sure, but unless we go with Seth’s option, then it’s just going to happen again….
> 
>> On 11 Jan 2020, at 23:28, Wayne Stambaugh <stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>> wrote:
>> 
>> I agree that adding the curly brackets would be the best option as well.
>> It's less than ideal but it resolves the issue.
>> 
>> On 1/11/20 6:21 PM, Ian McInerney wrote:
>>> That is probably the best option, since many things in wxWidgets are
>>> implemented as macros but masquerade as functions.
>>> 
>>> -Ian
>>> 
>>> On Sat, Jan 11, 2020 at 10:07 PM <seth@xxxxxxxxxxxxx <mailto:seth@xxxxxxxxxxxxx>
>>> <mailto:seth@xxxxxxxxxxxxx <mailto:seth@xxxxxxxxxxxxx>>> wrote:
>>> 
>>>    I suppose that we could update our coding policy to require braces
>>>    even for single line statements.
>>> 
>>>    -Seth
>>> 
>>>    On Jan 11, 2020 1:28 PM, Jeff Young <jeff@xxxxxxxxx <mailto:jeff@xxxxxxxxx>
>>>    <mailto:jeff@xxxxxxxxx <mailto:jeff@xxxxxxxxx>>> wrote:
>>> 
>>>        This looks safe enough:
>>> 
>>>        if( n_changed )
>>>            wxLogTrace( "CN", "Cluster %p : net : %d %s\n", cluster.get(),
>>>                    cluster->OriginNet(), (const char*) cluster->OriginNetName().c_str() );
>>>        else
>>>        wxLogTrace( "CN", "Cluster %p : nothing to propagate\n", cluster.get() );
>>> 
>>> 
>>>        Sadly, the macro wxLogTrace is not parenthesized, and starts
>>>        with an if statement.  So the else doesn’t go where you think it
>>>        does….
>>> 
>>>        Any ideas on how to fix this that don’t include constantly
>>>        checking to see if new instances have been introduced?
>>> 
>>> 
>>>    _______________________________________________
>>>    Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>>>    Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>    <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>>>    Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>>>    More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
>>> 
>>> 
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>>> More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
>>> 
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>> More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References