← Back to team overview

kicad-developers team mailing list archive

[PATCH] Clean up warnings from exception handlers

 

The exception objects caught are either not referenced at all, or only in
debug builds. This avoids the warnings for the unused variables.
---
 eeschema/class_libentry.cpp            | 2 +-
 eeschema/class_library.cpp             | 4 ++--
 eeschema/cross-probing.cpp             | 2 +-
 eeschema/dialogs/dialog_bom.cpp        | 2 +-
 eeschema/eeschema_config.cpp           | 6 +++---
 eeschema/lib_export.cpp                | 2 +-
 eeschema/project_rescue.cpp            | 6 +++---
 eeschema/schframe.cpp                  | 2 +-
 eeschema/symbedit.cpp                  | 2 +-
 pcb_calculator/datafile_read_write.cpp | 2 +-
 pcbnew/class_module.cpp                | 2 +-
 pcbnew/cross-probing.cpp               | 2 +-
 pcbnew/dialogs/wizard_add_fplib.cpp    | 2 +-
 pcbnew/kicad_plugin.cpp                | 2 +-
 pcbnew/moduleframe.cpp                 | 8 ++++----
 pcbnew/tools/conditional_menu.cpp      | 2 +-
 plugins/3d/vrml/vrml.cpp               | 2 +-
 utils/idftools/idf_parser.cpp          | 8 ++++----
 18 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
index 3a63093..83a049c 100644
--- a/eeschema/class_libentry.cpp
+++ b/eeschema/class_libentry.cpp
@@ -140,7 +140,7 @@ bool LIB_ALIAS::SaveDoc( OUTPUTFORMATTER& aFormatter )
 
         aFormatter.Print( 0, "$ENDCMP\n" );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& )
     {
         return false;
     }
diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp
index 8776e62..71be7df 100644
--- a/eeschema/class_library.cpp
+++ b/eeschema/class_library.cpp
@@ -655,7 +655,7 @@ bool PART_LIB::Save( OUTPUTFORMATTER& aFormatter )
 
         aFormatter.Print( 0, "#\n#End Library\n" );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& )
     {
         success = false;
     }
@@ -680,7 +680,7 @@ bool PART_LIB::SaveDocs( OUTPUTFORMATTER& aFormatter )
 
         aFormatter.Print( 0, "#\n#End Doc Library\n" );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& )
     {
         success = false;
     }
diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp
index f1f9e31..7bc8e63 100644
--- a/eeschema/cross-probing.cpp
+++ b/eeschema/cross-probing.cpp
@@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
         {
             backAnnotateFootprints( payload );
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& DBG( ioe ) )
         {
             DBG( printf( "%s: ioe:%s\n", __func__, TO_UTF8( ioe.What() ) );)
         }
diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp
index b971a1f..e6c293b 100644
--- a/eeschema/dialogs/dialog_bom.cpp
+++ b/eeschema/dialogs/dialog_bom.cpp
@@ -300,7 +300,7 @@ void DIALOG_BOM::installPluginsList()
         {
             cfg_parser.Parse();
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& )
         {
 //            wxLogMessage( ioe.What() );
         }
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index 2996d08..275dd71 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -138,7 +138,7 @@ void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
     {
         PART_LIBS::LibNamesAndPaths( prj, false, &lib_paths, &lib_names );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& DBG( ioe ) )
     {
         DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
         return;
@@ -198,7 +198,7 @@ void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
     {
         PART_LIBS::LibNamesAndPaths( prj, false, &lib_paths, &lib_names );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& DBG( ioe ) )
     {
         DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
         return;
@@ -659,7 +659,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
         {
             m_TemplateFieldNames.Parse( &lexer );
         }
-        catch( const IO_ERROR& e )
+        catch( const IO_ERROR& DBG( e ) )
         {
             // @todo show error msg
             DBG( printf( "templatefieldnames parsing error: '%s'\n",
diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp
index 8b51884..6de8ff9 100644
--- a/eeschema/lib_export.cpp
+++ b/eeschema/lib_export.cpp
@@ -66,7 +66,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
         std::unique_ptr<PART_LIB> new_lib( PART_LIB::LoadLibrary( fn.GetFullPath() ) );
         lib = std::move( new_lib );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& )
     {
         wxString msg = wxString::Format( _(
             "Unable to import library '%s'.  Error:\n"
diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp
index 6e0bfc1..4e06ce8 100644
--- a/eeschema/project_rescue.cpp
+++ b/eeschema/project_rescue.cpp
@@ -113,7 +113,7 @@ static bool insert_library( PROJECT *aProject, PART_LIB *aLibrary, size_t aIndex
         libNames.Insert( libName, aIndex );
         PART_LIBS::LibNamesAndPaths( aProject, true, &libPaths, &libNames );
     }
-    catch( const IO_ERROR& e )
+    catch( const IO_ERROR& )
     {
         // Could not get or save the current libraries.
         return false;
@@ -131,12 +131,12 @@ static bool insert_library( PROJECT *aProject, PART_LIB *aLibrary, size_t aIndex
     {
         libs->LoadAllLibraries( aProject );
     }
-    catch( const PARSE_ERROR& e )
+    catch( const PARSE_ERROR& )
     {
         // Some libraries were not found. There's no point in showing the error,
         // because it was already shown. Just don't do anything.
     }
-    catch( const IO_ERROR& e )
+    catch( const IO_ERROR& )
     {
         // Restore the old list
         libs->clear();
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index bd89398..0a05684 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -115,7 +115,7 @@ SEARCH_STACK* PROJECT::SchSearchS()
         {
             PART_LIBS::LibNamesAndPaths( this, false, &libDir );
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& DBG( ioe ) )
         {
             DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
         }
diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp
index 96d1045..0a1d6b6 100644
--- a/eeschema/symbedit.cpp
+++ b/eeschema/symbedit.cpp
@@ -233,7 +233,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
             formatter.Print( 0, "ENDDRAW\n" );
             formatter.Print( 0, "ENDDEF\n" );
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& )
         {
             msg.Printf( _( "An error occurred attempting to save symbol file '%s'" ),
                         GetChars( fn.GetFullPath() ) );
diff --git a/pcb_calculator/datafile_read_write.cpp b/pcb_calculator/datafile_read_write.cpp
index fda6a9f..b0c795e 100644
--- a/pcb_calculator/datafile_read_write.cpp
+++ b/pcb_calculator/datafile_read_write.cpp
@@ -103,7 +103,7 @@ bool PCB_CALCULATOR_FRAME::WriteDataFile()
         while( nestlevel-- )
             formatter.Print( nestlevel, ")\n" );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& )
     {
         return false;
     }
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index 726cd48..37effe3 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -820,7 +820,7 @@ void MODULE::RunOnChildren( std::function<void (BOARD_ITEM*)> aFunction )
         aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
         aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
     }
-    catch( std::bad_function_call& e )
+    catch( std::bad_function_call& )
     {
         DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
     }
diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp
index d980ee4..dbb1042 100644
--- a/pcbnew/cross-probing.cpp
+++ b/pcbnew/cross-probing.cpp
@@ -255,7 +255,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
             KICAD_NETLIST_READER netlistReader( lineReader, &netlist );
             netlistReader.LoadNetlist();
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& )
         {
             assert( false ); // should never happen
         }
diff --git a/pcbnew/dialogs/wizard_add_fplib.cpp b/pcbnew/dialogs/wizard_add_fplib.cpp
index 348da39..1d0ccbf 100644
--- a/pcbnew/dialogs/wizard_add_fplib.cpp
+++ b/pcbnew/dialogs/wizard_add_fplib.cpp
@@ -178,7 +178,7 @@ bool WIZARD_FPLIB_TABLE::LIBRARY::Test()
     {
         footprints = p->FootprintEnumerate( m_path );
     }
-    catch( IO_ERROR& e )
+    catch( IO_ERROR& )
     {
         m_status = LIBRARY::INVALID;
         return false;
diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index 349d67f..f6d516e 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -1740,7 +1740,7 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPER
     {
         board = dynamic_cast<BOARD*>( m_parser->Parse() );
     }
-    catch( const FUTURE_FORMAT_ERROR& parse_error )
+    catch( const FUTURE_FORMAT_ERROR& )
     {
         // Don't wrap a FUTURE_FORMAT_ERROR in another
         throw;
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 25c80e3..e94deed 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -366,7 +366,7 @@ const wxString FOOTPRINT_EDIT_FRAME::getLibPath()
 
         return row->GetFullURI( true );
     }
-    catch( const IO_ERROR& ioe )
+    catch( const IO_ERROR& )
     {
         return wxEmptyString;
     }
@@ -409,12 +409,12 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
         {
             module = (MODULE*) pcb_io.Parse( pretty );
         }
-        catch( const PARSE_ERROR& pe )
+        catch( const PARSE_ERROR& )
         {
             // unlikely to be a problem, since we produced the pretty string.
             wxLogError( wxT( "PARSE_ERROR" ) );
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& )
         {
             // unlikely to be a problem, since we produced the pretty string.
             wxLogError( wxT( "IO_ERROR" ) );
@@ -767,7 +767,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
 
             nickname_display = nickname;
         }
-        catch( const IO_ERROR& ioe )
+        catch( const IO_ERROR& )
         {
             // user may be bewildered as to why after selecting a library it is not showing up
             // in the title, we could show an error message, but that should have been done at time
diff --git a/pcbnew/tools/conditional_menu.cpp b/pcbnew/tools/conditional_menu.cpp
index a0e0937..970cce9 100644
--- a/pcbnew/tools/conditional_menu.cpp
+++ b/pcbnew/tools/conditional_menu.cpp
@@ -60,7 +60,7 @@ CONTEXT_MENU* CONDITIONAL_MENU::Generate( SELECTION& aSelection )
             if( !cond( aSelection ) )
                 continue;
         }
-        catch( std::exception& e )
+        catch( std::exception& )
         {
             continue;
         }
diff --git a/plugins/3d/vrml/vrml.cpp b/plugins/3d/vrml/vrml.cpp
index 4cafe02..c2e2ab5 100644
--- a/plugins/3d/vrml/vrml.cpp
+++ b/plugins/3d/vrml/vrml.cpp
@@ -186,7 +186,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
         // longer lines then perhaps it shouldn't be used
         modelFile = new FILE_LINE_READER( aFileName, 0, 8388608 );
     }
-    catch( IO_ERROR &e )
+    catch( IO_ERROR & )
     {
         wxLogError( _( " * [INFO] load failed: input line too long\n" ) );
         return NULL;
diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp
index 6b3b9d9..5768c30 100644
--- a/utils/idftools/idf_parser.cpp
+++ b/utils/idftools/idf_parser.cpp
@@ -2381,7 +2381,7 @@ void IDF3_BOARD::readBoardFile( const std::string& aFileName, bool aNoSubstitute
             }
         }
     }
-    catch( const std::exception& e )
+    catch( const std::exception& )
     {
         brd.exceptions ( std::ios_base::goodbit );
 
@@ -2699,7 +2699,7 @@ void IDF3_BOARD::readLibFile( const std::string& aFileName )
 
         while( lib.good() ) readLibSection( lib, state, this );
     }
-    catch( const std::exception& e )
+    catch( const std::exception& )
     {
         lib.exceptions ( std::ios_base::goodbit );
 
@@ -2853,7 +2853,7 @@ bool IDF3_BOARD::writeLibFile( const std::string& aFileName )
         }
 
     }
-    catch( const std::exception& e )
+    catch( const std::exception& )
     {
         lib.exceptions( std::ios_base::goodbit );
 
@@ -3120,7 +3120,7 @@ void IDF3_BOARD::writeBoardFile( const std::string& aFileName )
         }
 
     }
-    catch( const std::exception& e )
+    catch( const std::exception& )
     {
         brd.exceptions( std::ios_base::goodbit );
 

References