From 548e5f49bd4f759b972f4a874a44c38a350378e1 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 5 Oct 2021 09:57:25 -0700 Subject: [PATCH] Clean up unused variable usage Unused variables in function calls can be commented out. Unused return variables get a new routine `ignore_unused()` that silences the warnings with zero overhead. --- 3d-viewer/3d_canvas/eda_3d_canvas.cpp | 4 +- .../3d_rendering/3d_render_raytracing/light.h | 4 +- .../render_3d_raytrace.cpp | 8 +-- .../shapes3D/cylinder_3d.cpp | 4 +- .../shapes3D/dummy_block_3d.cpp | 4 +- .../shapes3D/layer_item_3d.cpp | 4 +- .../shapes3D/plane_3d.cpp | 4 +- .../shapes3D/round_segment_3d.cpp | 4 +- common/dialog_shim.cpp | 6 ++- common/kiway.cpp | 3 +- common/kiway_holder.cpp | 5 +- common/plotters/PDF_plotter.cpp | 3 +- common/richio.cpp | 4 +- common/tool/tool_dispatcher.cpp | 3 +- common/widgets/gal_options_panel.cpp | 2 +- .../netlist_exporter_cadstar.cpp | 3 +- .../netlist_exporter_orcadpcb2.cpp | 3 +- eeschema/sch_edit_frame.cpp | 3 +- gerbview/rs274x.cpp | 3 +- include/ignore.h | 24 +++++++++ pcbnew/kicad_clipboard.cpp | 5 +- pcbnew/load_select_footprint.cpp | 4 +- pcbnew/plugin.cpp | 4 +- pcbnew/plugins/kicad/pcb_parser.cpp | 3 +- pcbnew/plugins/legacy/legacy_plugin.cpp | 51 +++++++------------ .../scripting/pcbnew_scripting_helpers.cpp | 3 +- qa/eeschema/test_eagle_plugin.cpp | 3 +- qa/eeschema/test_sch_rtree.cpp | 19 +++---- .../polygon_triangulation.cpp | 3 +- 29 files changed, 97 insertions(+), 96 deletions(-) create mode 100644 include/ignore.h diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 998e0b3068..36803243ca 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -837,10 +837,8 @@ void EDA_3D_CANVAS::OnMiddleUp( wxMouseEvent& event ) } -void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent& event ) +void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent& /* event */ ) { - (void)event; - m_mouse_is_moving = false; m_mouse_was_moved = false; diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/light.h b/3d-viewer/3d_rendering/3d_render_raytracing/light.h index 7d1e33ff10..ae78b15b80 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/light.h +++ b/3d-viewer/3d_rendering/3d_render_raytracing/light.h @@ -131,11 +131,9 @@ public: void SetDirection( const SFVEC3F& aDir ) { m_inv_direction = -aDir; } // Imported functions from LIGHT - void GetLightParameters( const SFVEC3F& aHitPoint, SFVEC3F& aOutVectorToLight, + void GetLightParameters( const SFVEC3F& /* aHitPoint */, SFVEC3F& aOutVectorToLight, SFVEC3F& aOutLightColor, float& aOutDistance ) const override { - (void)aHitPoint; // unused - aOutVectorToLight = m_inv_direction; aOutDistance = std::numeric_limits::infinity(); aOutLightColor = m_color; diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/render_3d_raytrace.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/render_3d_raytrace.cpp index 20e95d6505..ae42701a8c 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/render_3d_raytrace.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/render_3d_raytrace.cpp @@ -839,10 +839,8 @@ void RENDER_3D_RAYTRACE::renderBlockTracing( GLubyte* ptrPBO, signed int iBlock } -void RENDER_3D_RAYTRACE::postProcessShading( GLubyte* ptrPBO, REPORTER* aStatusReporter ) +void RENDER_3D_RAYTRACE::postProcessShading( GLubyte* /* ptrPBO */, REPORTER* aStatusReporter ) { - (void)ptrPBO; // unused - if( m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) ) { if( aStatusReporter ) @@ -894,10 +892,8 @@ void RENDER_3D_RAYTRACE::postProcessShading( GLubyte* ptrPBO, REPORTER* aStatusR } -void RENDER_3D_RAYTRACE::postProcessBlurFinish( GLubyte* ptrPBO, REPORTER* aStatusReporter ) +void RENDER_3D_RAYTRACE::postProcessBlurFinish( GLubyte* ptrPBO, REPORTER* /* aStatusReporter */ ) { - (void) aStatusReporter; //unused - if( m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) ) { // Now blurs the shader result and compute the final color diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cylinder_3d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cylinder_3d.cpp index fe6ffd15e6..bb3af2279f 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cylinder_3d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cylinder_3d.cpp @@ -167,9 +167,7 @@ bool CYLINDER::Intersects( const BBOX_3D& aBBox ) const } -SFVEC3F CYLINDER::GetDiffuseColor( const HITINFO& aHitInfo ) const +SFVEC3F CYLINDER::GetDiffuseColor( const HITINFO& /* aHitInfo */ ) const { - (void)aHitInfo; // unused - return m_diffusecolor; } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/dummy_block_3d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/dummy_block_3d.cpp index 438b74b113..94fb3ebdd1 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/dummy_block_3d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/dummy_block_3d.cpp @@ -86,9 +86,7 @@ bool DUMMY_BLOCK::Intersects( const BBOX_3D& aBBox ) const } -SFVEC3F DUMMY_BLOCK::GetDiffuseColor( const HITINFO& aHitInfo ) const +SFVEC3F DUMMY_BLOCK::GetDiffuseColor( const HITINFO& /* aHitInfo */ ) const { - (void)aHitInfo; // unused - return m_diffusecolor; } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/layer_item_3d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/layer_item_3d.cpp index 1ef091700d..41a2d651da 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/layer_item_3d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/layer_item_3d.cpp @@ -475,9 +475,7 @@ bool LAYER_ITEM::Intersects( const BBOX_3D& aBBox ) const } -SFVEC3F LAYER_ITEM::GetDiffuseColor( const HITINFO& aHitInfo ) const +SFVEC3F LAYER_ITEM::GetDiffuseColor( const HITINFO& /* aHitInfo */ ) const { - (void)aHitInfo; // unused - return m_diffusecolor; } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/plane_3d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/plane_3d.cpp index 5124bbef40..9f3ad221af 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/plane_3d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/plane_3d.cpp @@ -118,9 +118,7 @@ bool XY_PLANE::Intersects( const BBOX_3D& aBBox ) const } -SFVEC3F XY_PLANE::GetDiffuseColor( const HITINFO& aHitInfo ) const +SFVEC3F XY_PLANE::GetDiffuseColor( const HITINFO& /* aHitInfo */ ) const { - (void)aHitInfo; // unused - return m_diffusecolor; } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/round_segment_3d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/round_segment_3d.cpp index f09da96ea1..809aed7cbf 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/round_segment_3d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/round_segment_3d.cpp @@ -415,9 +415,7 @@ bool ROUND_SEGMENT::Intersects( const BBOX_3D& aBBox ) const } -SFVEC3F ROUND_SEGMENT::GetDiffuseColor( const HITINFO& aHitInfo ) const +SFVEC3F ROUND_SEGMENT::GetDiffuseColor( const HITINFO& /* aHitInfo */ ) const { - (void)aHitInfo; // unused - return m_diffusecolor; } diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 2bfdc8b38e..8f2bf9a4d3 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -23,6 +23,7 @@ */ #include +#include #include #include #include @@ -336,6 +337,8 @@ static void selectAllInTextCtrls( wxWindowList& children ) { childTextCtrl->SelectAll(); } +#else + ignore_unused( childTextCtrl ); #endif } else if( wxStyledTextCtrl* scintilla = dynamic_cast( child ) ) @@ -536,8 +539,7 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent ) // isn't closing anyway) if( Validate() ) { - bool success = TransferDataFromWindow(); - (void) success; + ignore_unused( TransferDataFromWindow() ); } } else if( id == GetEscapeId() || diff --git a/common/kiway.cpp b/common/kiway.cpp index 34494dd2d3..6476120538 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -280,7 +281,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad ) if( kiface->OnKifaceStart( m_program, m_ctl ) ) { // Tell dso's wxDynamicLibrary destructor not to Unload() the program image. - (void) dso.Detach(); + ignore_unused( dso.Detach() ); return m_kiface[aFaceId] = kiface; } diff --git a/common/kiway_holder.cpp b/common/kiway_holder.cpp index 74a5f2e723..aec5a46dd4 100644 --- a/common/kiway_holder.cpp +++ b/common/kiway_holder.cpp @@ -23,6 +23,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include #include @@ -47,11 +48,11 @@ void KIWAY_HOLDER::SetKiway( wxWindow* aDest, KIWAY* aKiway ) if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) ) { int breakhere=1; - (void) breakhere; + ignore_unused( breakhere ); } #endif - (void) aDest; + ignore_unused( aDest ); m_kiway = aKiway; } diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 95949a492e..4b70ed2493 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -535,7 +536,7 @@ void PDF_PLOTTER::closePdfStream() int rc = fread( inbuf, 1, stream_len, workFile ); wxASSERT( rc == stream_len ); - (void) rc; + ignore_unused( rc ); // We are done with the temporary file, junk it fclose( workFile ); diff --git a/common/richio.cpp b/common/richio.cpp index 2420d332ab..35f95f1ac9 100644 --- a/common/richio.cpp +++ b/common/richio.cpp @@ -26,6 +26,7 @@ #include #include // HAVE_FGETC_NOLOCK +#include #include #include @@ -93,8 +94,7 @@ std::string StrPrintf( const char* format, ... ) va_list args; va_start( args, format ); - int ignore = vprint( &ret, format, args ); - (void) ignore; + ignore_unused( vprint( &ret, format, args ) ); va_end( args ); return ret; diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index ff06aaa81a..747b2bf6d9 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -23,6 +23,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include @@ -378,7 +379,7 @@ OPT TOOL_DISPATCHER::GetToolEvent( wxKeyEvent* aKeyEvent, bool* keyI #ifdef __APPLE__ if( unicode_key >= 'A' && unicode_key <= 'Z' && key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z ) #else - (void) unicode_key; //not used: avoid compil warning + ignore_unused( unicode_key ); if( key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z ) #endif diff --git a/common/widgets/gal_options_panel.cpp b/common/widgets/gal_options_panel.cpp index 622f8f655c..057b27690a 100644 --- a/common/widgets/gal_options_panel.cpp +++ b/common/widgets/gal_options_panel.cpp @@ -219,7 +219,7 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow() else m_renderingEngine->SetSelection( 1 ); #else - (void) m_drawFrame; // Quiet unused variable warning + ignore_unused( m_drawFrame ); #endif m_gridSnapOptions->SetSelection( UTIL::GetConfigForVal( gridSnapConfigVals, diff --git a/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp b/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp index 1936105ca8..df2261847d 100644 --- a/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp @@ -37,9 +37,8 @@ static wxString StartLine( wxT( "." ) ); bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, - unsigned aNetlistOptions ) + unsigned /* aNetlistOptions */ ) { - (void)aNetlistOptions; //unused int ret = 0; FILE* f = nullptr; diff --git a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp index d546c9b41d..b53022be4a 100644 --- a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp @@ -37,9 +37,8 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, - unsigned aNetlistOptions ) + unsigned /* aNetlistOptions */ ) { - (void)aNetlistOptions; //unused FILE* f = nullptr; wxString field; wxString footprint; diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 96edd2c78b..608d421811 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -755,7 +756,7 @@ void SCH_EDIT_FRAME::ResolveERCExclusions() for( SCH_MARKER* marker : Schematic().ResolveERCExclusions() ) { SCH_SHEET_PATH errorPath; - (void) sheetList.GetItem( marker->GetRCItem()->GetMainItemID(), &errorPath ); + ignore_unused( sheetList.GetItem( marker->GetRCItem()->GetMainItemID(), &errorPath ) ); if( errorPath.LastScreen() ) errorPath.LastScreen()->Append( marker ); diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 7069ef9149..dc47923c6e 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -897,7 +898,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff, break; } - (void) seq_len; // quiet g++, or delete the unused variable. + ignore_unused( seq_len ); ok = GetEndOfBlock( aBuff, aBuffSize, aText, m_Current_File ); diff --git a/include/ignore.h b/include/ignore.h new file mode 100644 index 0000000000..7598216a8a --- /dev/null +++ b/include/ignore.h @@ -0,0 +1,24 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2021 KiCad Developers, see CHANGELOG.TXT for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 3 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html + * or you may search the http://www.gnu.org website for the version 3 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +template void ignore_unused( const T& ) { } diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 58d4755939..722e30b603 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -294,7 +295,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri { wxTextDataObject data; clipboard->GetData( data ); - ( void )data.GetText(); // Keep unused variable + ignore_unused( data.GetText() ); } #endif } @@ -373,7 +374,7 @@ void CLIPBOARD_IO::Save( const wxString& aFileName, BOARD* aBoard, { wxTextDataObject data; clipboard->GetData( data ); - ( void )data.GetText(); // Keep unused variable + ignore_unused( data.GetText() ); } } diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index d893c1d729..9fb1dc912b 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -38,6 +38,7 @@ using namespace std::placeholders; #include #include #include +#include #include #include #include @@ -201,8 +202,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser() viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER_MODAL, true, this ); wxString fpid; - int ret = viewer->ShowModal( &fpid, this ); - (void) ret; // make static analyser quiet + ignore_unused( viewer->ShowModal( &fpid, this ) ); viewer->Destroy(); diff --git a/pcbnew/plugin.cpp b/pcbnew/plugin.cpp index c5a9b7eaad..2a20574718 100644 --- a/pcbnew/plugin.cpp +++ b/pcbnew/plugin.cpp @@ -72,10 +72,8 @@ void PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& } -void PLUGIN::PrefetchLib( const wxString& aLibraryPath, const PROPERTIES* aProperties ) +void PLUGIN::PrefetchLib( const wxString&, const PROPERTIES* ) { - (void) aLibraryPath; - (void) aProperties; } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index e1336a3dd0..0d03b77863 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -5078,7 +5079,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) break; case T_arc_segments: - static_cast( parseInt( "arc segment count" ) ); + ignore_unused( parseInt( "arc segment count" ) ); NeedRIGHT(); break; diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 5fcf32c52b..9af1eda3cf 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -459,7 +460,7 @@ BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, loadAllSections( bool( aAppendToMe ) ); - (void)boardDeleter.release(); // give it up so we dont delete it on exit + ignore_unused( boardDeleter.release() ); // give it up so we dont delete it on exit m_progressReporter = nullptr; return m_board; } @@ -1876,7 +1877,7 @@ void LEGACY_PLUGIN::loadPCB_LINE() dseg->SetLayer( leg_layer2new( m_cu_count, layer ) ); break; case 1: - (void)intParse( data ); + ignore_unused( intParse( data ) ); break; case 2: double angle; @@ -2397,7 +2398,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() else if( TESTLINE( "ZAux" ) ) // aux info found { // e.g. "ZAux 7 E" - int ignore = intParse( line + SZ( "ZAux" ), &data ); + ignore_unused( intParse( line + SZ( "ZAux" ), &data ) ); char* hopt = strtok_r( (char*) data, delims, (char**) &data ); if( !hopt ) @@ -2418,8 +2419,6 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() THROW_IO_ERROR( m_error ); } - (void) ignore; - // Set hatch mode later, after reading corner outline data } else if( TESTLINE( "ZSmoothing" ) ) @@ -2473,7 +2472,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() { // e.g. "ZOptions 0 32 F 200 200" int fillmode = intParse( line + SZ( "ZOptions" ), &data ); - static_cast( intParse( data, &data ) ); // Ignored + ignore_unused( intParse( data, &data ) ); char fillstate = data[1]; // here e.g. " F" BIU thermalReliefGap = biuParse( data += 2 , &data ); // +=2 for " F" BIU thermalReliefCopperBridge = biuParse( data ); @@ -2686,7 +2685,7 @@ void LEGACY_PLUGIN::loadDIMENSION() } else if( TESTLINE( "Sb" ) ) { - int ignore = biuParse( line + SZ( "Sb" ), &data ); + ignore_unused( biuParse( line + SZ( "Sb" ), &data ) ); BIU crossBarOx = biuParse( data, &data ); BIU crossBarOy = biuParse( data, &data ); BIU crossBarFx = biuParse( data, &data ); @@ -2696,74 +2695,60 @@ void LEGACY_PLUGIN::loadDIMENSION() dim->SetLineThickness( width ); dim->UpdateHeight( wxPoint( crossBarFx, crossBarFy ), wxPoint( crossBarOx, crossBarOy ) ); - (void) ignore; } else if( TESTLINE( "Sd" ) ) { - int ignore = intParse( line + SZ( "Sd" ), &data ); + ignore_unused( intParse( line + SZ( "Sd" ), &data ) ); BIU featureLineDOx = biuParse( data, &data ); BIU featureLineDOy = biuParse( data, &data ); - BIU featureLineDFx = biuParse( data, &data ); - BIU featureLineDFy = biuParse( data ); + + ignore_unused( biuParse( data, &data ) ); + ignore_unused( biuParse( data ) ); dim->SetStart( wxPoint( featureLineDOx, featureLineDOy ) ); - ( void )ignore; - ( void )featureLineDFx; - ( void )featureLineDFy; } else if( TESTLINE( "Sg" ) ) { - int ignore = intParse( line + SZ( "Sg" ), &data ); + ignore_unused( intParse( line + SZ( "Sg" ), &data ) ); BIU featureLineGOx = biuParse( data, &data ); BIU featureLineGOy = biuParse( data, &data ); - BIU featureLineGFx = biuParse( data, &data ); - BIU featureLineGFy = biuParse( data ); - (void) ignore; + ignore_unused( biuParse( data, &data ) ); + ignore_unused( biuParse( data ) ); + dim->SetEnd( wxPoint( featureLineGOx, featureLineGOy ) ); - ( void )ignore; - ( void )featureLineGFx; - ( void )featureLineGFy; } else if( TESTLINE( "S1" ) ) // Arrow: no longer imported { - int ignore = intParse( line + SZ( "S1" ), &data ); + ignore_unused( intParse( line + SZ( "S1" ), &data ) ); biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); biuParse( data ); - - (void) ignore; } else if( TESTLINE( "S2" ) ) // Arrow: no longer imported { - int ignore = intParse( line + SZ( "S2" ), &data ); + ignore_unused( intParse( line + SZ( "S2" ), &data ) ); biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); biuParse( data, &data ); - - (void) ignore; } else if( TESTLINE( "S3" ) ) // Arrow: no longer imported { - int ignore = intParse( line + SZ( "S3" ), &data ); + ignore_unused( intParse( line + SZ( "S3" ), &data ) ); biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); biuParse( data, &data ); - - (void) ignore; } else if( TESTLINE( "S4" ) ) // Arrow: no longer imported { - int ignore = intParse( line + SZ( "S4" ), &data ); + ignore_unused( intParse( line + SZ( "S4" ), &data ) ); biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); // skipping excessive data biuParse( data, &data ); biuParse( data, &data ); - - (void) ignore; } } diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index 6ebd0bb69f..f2b29fcb08 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -99,7 +100,7 @@ SETTINGS_MANAGER* GetSettingsManager() else { // Ensure wx system settings stuff is available - static_cast( wxTheApp ); + ignore_unused( wxTheApp ); s_SettingsManager = new SETTINGS_MANAGER( true ); } } diff --git a/qa/eeschema/test_eagle_plugin.cpp b/qa/eeschema/test_eagle_plugin.cpp index 2459d4b96b..d6cb73c3a2 100644 --- a/qa/eeschema/test_eagle_plugin.cpp +++ b/qa/eeschema/test_eagle_plugin.cpp @@ -24,6 +24,7 @@ #include +#include #include #include @@ -64,7 +65,7 @@ BOOST_AUTO_TEST_CASE( Load ) BOOST_TEST_MESSAGE( fn.GetFullPath() ); - (void) pi; + ignore_unused( pi ); // This doesn't work with a null KiWay. // const SCH_SHEET* sheet = pi->Load( fn.GetFullPath(), nullptr ); // BOOST_CHECK_NE( nullptr, sheet ); diff --git a/qa/eeschema/test_sch_rtree.cpp b/qa/eeschema/test_sch_rtree.cpp index d7c625eb75..f138fe5fa0 100644 --- a/qa/eeschema/test_sch_rtree.cpp +++ b/qa/eeschema/test_sch_rtree.cpp @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -65,7 +66,7 @@ BOOST_AUTO_TEST_CASE( Default ) int count = 0; for( auto item : m_tree ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -76,7 +77,7 @@ BOOST_AUTO_TEST_CASE( Default ) count = 0; for( auto item : m_tree.OfType( KICAD_T( type ) ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -90,7 +91,7 @@ BOOST_AUTO_TEST_CASE( Default ) count = 0; for( auto item : m_tree.Overlapping( SCH_JUNCTION_T, bbox ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -111,7 +112,7 @@ BOOST_AUTO_TEST_CASE( Junctions ) for( auto item : m_tree.OfType( SCH_JUNCTION_T ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -120,7 +121,7 @@ BOOST_AUTO_TEST_CASE( Junctions ) count = 0; for( auto item : m_tree.OfType( SCH_NO_CONNECT_T ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -199,7 +200,7 @@ BOOST_AUTO_TEST_CASE( MixedElements ) for( auto item : m_tree.OfType( SCH_JUNCTION_T ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -208,7 +209,7 @@ BOOST_AUTO_TEST_CASE( MixedElements ) count = 0; for( auto item : m_tree.OfType( SCH_NO_CONNECT_T ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -261,7 +262,7 @@ BOOST_AUTO_TEST_CASE( SingleElementTree ) for( auto item : m_tree.OfType( SCH_JUNCTION_T ) ) { - static_cast( item ); + ignore_unused( item ); count++; } @@ -270,7 +271,7 @@ BOOST_AUTO_TEST_CASE( SingleElementTree ) count = 0; for( auto item : m_tree.OfType( SCH_NO_CONNECT_T ) ) { - static_cast( item ); + ignore_unused( item ); count++; } diff --git a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp index 79c07f6d63..a2cbcd5fc8 100644 --- a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp +++ b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -242,7 +243,7 @@ int polygon_triangulation_main( int argc, char *argv[] ) poly.CacheTriangulation(); - (void) poly; + ignore_unused( poly ); #if 0 PROF_COUNTER unfrac("unfrac"); poly.Unfracture( SHAPE_POLY_SET::PM_FAST );