← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Warnings cleanup

 

Mmmm I am not an expert but does using the static_cast<int> on the enum
constant really solve the problem or just make it invisible?
I think the enums should not be uint64_t but some smaller int type.

include/layers_id_colors_and_visibility.h
The layer ids are just a small enum (fits in a CHAR), maybe the
NO_AVAILABLE_LAYERS
and UNSELECTED_LAYER should be defined there a bit differently.

#define UNDEFINED_LAYER     LAYER_ID(-1)
#define UNSELECTED_LAYER    LAYER_ID(-2)

Apparently this results in these super-size consts on your system


Just my $ 0.02 of opinion.

Greetings,
Edwin van den Oetelaar


On Sat, Jul 4, 2015 at 12:53 PM, Camille 019 <camille019@xxxxxxxxxxx> wrote:

> Hi,
>
> A set of patch to clean some warnings I get with Clang.
>
> The list of warnings :
>
> ../pcbnew/router/pns_router.cpp:208:10: warning: unused variable
> 'nonOrtho' [-Wunused-variable]
>     bool nonOrtho = false;
>
> ../pcbnew/router/pns_topology.cpp:385:21: note: use function 'std::abs'
> instead
>         gap = (int) abs( refDir.Cross( displacement ) /
> refDir.EuclideanNorm() ) - lp->Width();
>                     ^~~
>
> ../gerbview/./gerbview_frame.h:430:40: warning: comparison of constant
> 4294967295 with expression of type 'int' is always true
> [-Wtautological-constant-out-of-range-compare]
>         return getNextAvailableLayer() != NO_AVAILABLE_LAYERS;
>                ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
> ../gerbview/files.cpp:189:23: warning: comparison of constant 4294967295
> with expression of type 'int' is always false
> [-Wtautological-constant-out-of-range-compare]
>             if( layer == NO_AVAILABLE_LAYERS )
>                 ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
> ../gerbview/files.cpp:272:23: warning: comparison of constant 4294967295
> with expression of type 'int' is always false
> [-Wtautological-constant-out-of-range-compare]
>             if( layer == NO_AVAILABLE_LAYERS )
>                 ~~~~~ ^  ~~~~~~~~~~~~~~~~~~
>
> ../gerbview/select_layers_to_pcb.cpp:336:19: warning: comparison of
> constant 4294967294 with expression of type 'LAYER_NUM' (aka 'int') is
> always false [-Wtautological-constant-out-of-range-compare]
>         if( layer == UNSELECTED_LAYER )
>             ~~~~~ ^  ~~~~~~~~~~~~~~~~
> ../gerbview/select_layers_to_pcb.cpp:363:12: warning: comparison of
> constant 4294967294 with expression of type 'LAYER_NUM' (aka 'int') is
> always true [-Wtautological-constant-out-of-range-compare]
>     if( jj != UNSELECTED_LAYER && !IsValidLayer( jj ) )
>         ~~ ^  ~~~~~~~~~~~~~~~~
> ../gerbview/select_layers_to_pcb.cpp:368:12: warning: comparison of
> constant 4294967294 with expression of type 'LAYER_NUM' (aka 'int') is
> always true [-Wtautological-constant-out-of-range-compare]
>     if( jj != UNSELECTED_LAYER && !IsValidLayer( jj ) )
>         ~~ ^  ~~~~~~~~~~~~~~~~
> ../gerbview/select_layers_to_pcb.cpp:375:16: warning: comparison of
> constant 4294967294 with expression of type 'LAYER_NUM' (aka 'int') is
> always false [-Wtautological-constant-out-of-range-compare]
>         if( jj == UNSELECTED_LAYER )
>             ~~ ^  ~~~~~~~~~~~~~~~~
> ../gerbview/dialogs/dialog_select_one_pcb_layer.cpp:156:30: warning:
> comparison of constant 4294967294 with expression of type 'int' is always
> false [-Wtautological-constant-out-of-range-compare]
>         if( UNSELECTED_LAYER == aDefaultLayer )
>             ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
>
> Best regards,
>
> --
> Camille
>
> _______________________________________________
> 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
>
>

References