← Back to team overview

kicad-developers team mailing list archive

Re: [Patch] Removed set-but-unused failingDirCheck variable (was failingDirCheck in PNS router)

 

I moved the patch to an attachment to prevent gmail from mangling it.

Thanks,
Michael Beardsworth


On Tue, Aug 25, 2015 at 9:53 PM Michael Beardsworth <beardsworth@xxxxxxxxxx>
wrote:

> Hi all,
>
> I thought I'd introduce myself and contribute a small patch (inline) below.
>
> I'm a software (mostly) engineer in San Francisco, where I work in the
> robotics group at Google.  I spend the bulk of my time on robot code, but I
> also spend 20% time supporting build, test, continuous integration, and
> developer infrastructure for our group.
>
> I've been using KiCad for a personal project for a few months and am
> hoping to become a regular contributor to the project.
>
> See patch inline below (or let me know if it'd be better to send in via
> bzr.
>
> Thanks,
> Michael Beardsworth
>
> ---
>
> Removed set-but-unused failingDirCheck variable
>
> ---
>  pcbnew/router/pns_shove.cpp | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
> index f13983d..a2f5135 100644
> --- a/pcbnew/router/pns_shove.cpp
> +++ b/pcbnew/router/pns_shove.cpp
> @@ -152,7 +152,6 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet(
> PNS_LINE& aCurrent, PNS_LINE&
>  {
>      const SHAPE_LINE_CHAIN& obs = aObstacle.CLine();
>
> -    bool failingDirCheck = false;
>      int attempt;
>
>      for( attempt = 0; attempt < 4; attempt++ )
> @@ -207,7 +206,6 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet(
> PNS_LINE& aCurrent, PNS_LINE&
>          if( !checkBumpDirection( aCurrent, l ) )
>          {
>              TRACE( 100, "attempt %d fail direction-check", attempt );
> -            failingDirCheck = true;
>              aShoved.SetShape( l.CLine() );
>
>              continue;
>
>
> On Tue, Aug 25, 2015 at 5:37 PM Blair Bonnett <blair.bonnett@xxxxxxxxx>
> wrote:
>
>> Hi all,
>>
>> Just compiling the latest revision and GCC gave a warning I hadn't seen
>> in the code before:
>>
>> pcbnew/router/pns_shove.cpp: In member function ‘PNS_SHOVE::SHOVE_STATUS
>> PNS_SHOVE::processHullSet(PNS_LINE&, PNS_LINE&, PNS_LINE&, const
>> HULL_SET&)’:
>> pcbnew/router/pns_shove.cpp:155:10: warning: variable ‘failingDirCheck’
>> set but not used [-Wunused-but-set-variable]
>>
>> In r6105 the return of this function was changed from
>>     return failingDirCheck ? SH_OK : SH_INCOMPLETE;
>> to
>>     return SH_INCOMPLETE;
>>
>> So failingDirCheck is initialised on line 155, and set in a conditional
>> on line 210, but is no longer actually used. Can the variable be deleted to
>> get rid of the warning (and potential confusion for somebody reading the
>> code further down the track)?
>>
>> Blair
>> _______________________________________________
>> 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
>>
>

Attachment: unused_variable.patch
Description: Binary data


Follow ups

References