← Back to team overview

kicad-developers team mailing list archive

[PATCH] Warnings cleanup

 

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
 		 	   		  

Attachment: patch_warnings.diff
Description: Binary data

Attachment: patch_Wtautological-constant-out-of-range-compare.diff
Description: Binary data


Follow ups