From a852286eb56561b31ce3b65fee4a0e0949194c78 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 21 Jun 2022 17:04:56 -0700 Subject: [PATCH] Cleanup compile warnings --- common/commit.cpp | 3 ++ common/settings/app_settings.cpp | 3 -- eeschema/files-io.cpp | 2 -- eeschema/widgets/legacyfiledlg_save_project.h | 4 +-- include/locale_io.h | 6 ++-- kicad/pcm/dialogs/dialog_pcm_progress.cpp | 2 +- kicad/pcm/dialogs/dialog_pcm_progress.h | 2 +- kicad/pcm/pcm_task_manager.cpp | 28 +++++++++---------- .../drc_test_provider_zone_connections.cpp | 1 - 9 files changed, 24 insertions(+), 27 deletions(-) diff --git a/common/commit.cpp b/common/commit.cpp index e81ae40f69..e13c8fecb5 100644 --- a/common/commit.cpp +++ b/common/commit.cpp @@ -201,7 +201,10 @@ CHANGE_TYPE COMMIT::convert( UNDO_REDO aType ) const default: assert( false ); + // Can't fall through if the assert fires, so quiet our warning +#ifdef NDEBUG KI_FALLTHROUGH; +#endif case UNDO_REDO::CHANGED: return CHT_MODIFY; diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 19f616cba8..ca4d3edba7 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -28,9 +28,6 @@ #include #include -///! Update the schema version whenever a migration is required -const int appSettingsSchemaVersion = 0; - APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion ) : JSON_SETTINGS( aFilename, SETTINGS_LOC::USER, aSchemaVersion ), diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index ad1932b6d3..c98d5b9344 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -830,8 +830,6 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs ) return false; } - bool createNewProject = false; - #if wxCHECK_VERSION( 3, 1, 7 ) if( checkHook ) createNewProject = newProjectHook.GetCreateNewProject(); diff --git a/eeschema/widgets/legacyfiledlg_save_project.h b/eeschema/widgets/legacyfiledlg_save_project.h index 6285f2b348..cb5bad3c12 100644 --- a/eeschema/widgets/legacyfiledlg_save_project.h +++ b/eeschema/widgets/legacyfiledlg_save_project.h @@ -18,7 +18,7 @@ */ #ifndef LEGACYFILEDLG_SAVE_PROJ_H -#define LEGACYFILEDLG_SVE_PROJ_H +#define LEGACYFILEDLG_SAVE_PROJ_H #include #include @@ -53,4 +53,4 @@ protected: wxCheckBox* m_cbCreateProject; }; -#endif \ No newline at end of file +#endif diff --git a/include/locale_io.h b/include/locale_io.h index 12845e0da5..f8fbdb7d06 100644 --- a/include/locale_io.h +++ b/include/locale_io.h @@ -34,7 +34,7 @@ class wxLocale; * exceptions to be thrown. * * The constructor sets a "C" language locale option, to read/print files with floating - * point numbers. The destructor insures that the default locale is restored if an + * point numbers. The destructor insures that the default locale is restored whether an * exception is thrown or not. */ class LOCALE_IO @@ -50,7 +50,7 @@ private: // The locale in use before switching to the "C" locale // (the locale can be set by user, and is not always the system locale) std::string m_user_locale; - wxLocale* m_wxLocale; + [[maybe_unused]] wxLocale* m_wxLocale; }; -#endif \ No newline at end of file +#endif diff --git a/kicad/pcm/dialogs/dialog_pcm_progress.cpp b/kicad/pcm/dialogs/dialog_pcm_progress.cpp index fd7ca7a263..96be7382d6 100644 --- a/kicad/pcm/dialogs/dialog_pcm_progress.cpp +++ b/kicad/pcm/dialogs/dialog_pcm_progress.cpp @@ -67,7 +67,7 @@ void DIALOG_PCM_PROGRESS::OnCloseClicked( wxCommandEvent& event ) } -void DIALOG_PCM_PROGRESS::Report( const wxString& aText, SEVERITY aSeverity ) +void DIALOG_PCM_PROGRESS::PCMReport( const wxString& aText, SEVERITY aSeverity ) { std::lock_guard guard( m_mutex ); m_reports.push_back( std::make_pair( aText, aSeverity ) ); diff --git a/kicad/pcm/dialogs/dialog_pcm_progress.h b/kicad/pcm/dialogs/dialog_pcm_progress.h index 9bd73fb9a7..86a7f27028 100644 --- a/kicad/pcm/dialogs/dialog_pcm_progress.h +++ b/kicad/pcm/dialogs/dialog_pcm_progress.h @@ -49,7 +49,7 @@ public: DIALOG_PCM_PROGRESS( wxWindow* parent, bool aShowDownloadSection = true ); ///< Safe to call from non-UI thread. Adds a message to detailed report window. - void Report( const wxString& aText, SEVERITY aSeverity ); + void PCMReport( const wxString& aText, SEVERITY aSeverity ); ///< Safe to call from non-UI thread. Sets the download progress of the current zip entry. void SetDownloadProgress( uint64_t aDownloaded, uint64_t aTotal ); diff --git a/kicad/pcm/pcm_task_manager.cpp b/kicad/pcm/pcm_task_manager.cpp index 26e5964e08..371830ef2c 100644 --- a/kicad/pcm/pcm_task_manager.cpp +++ b/kicad/pcm/pcm_task_manager.cpp @@ -57,7 +57,7 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx if( !wxDirExists( file_path.GetPath() ) && !wxFileName::Mkdir( file_path.GetPath(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) ) { - m_reporter->Report( _( "Unable to create download directory!" ), RPT_SEVERITY_ERROR ); + m_reporter->PCMReport( _( "Unable to create download directory!" ), RPT_SEVERITY_ERROR ); return; } @@ -84,7 +84,7 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx if( !hash_match ) { - m_reporter->Report( wxString::Format( _( "Downloaded archive hash for package " + m_reporter->PCMReport( wxString::Format( _( "Downloaded archive hash for package " "%s does not match repository entry. " "This may indicate a problem with the " "package, if the issue persists " @@ -94,7 +94,7 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx } else { - m_reporter->Report( wxString::Format( _( "Extracting package '%s'." ), + m_reporter->PCMReport( wxString::Format( _( "Extracting package '%s'." ), aPackage.identifier ), RPT_SEVERITY_INFO ); @@ -110,7 +110,7 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx } } - m_reporter->Report( wxString::Format( _( "Removing downloaded archive '%s'." ), + m_reporter->PCMReport( wxString::Format( _( "Removing downloaded archive '%s'." ), file_path.GetFullName() ), RPT_SEVERITY_INFO ); wxRemoveFile( file_path.GetFullPath() ); @@ -149,7 +149,7 @@ int PCM_TASK_MANAGER::downloadFile( const wxString& aFilePath, const wxString& u curl.SetFollowRedirects( true ); curl.SetTransferCallback( callback, 250000L ); - m_reporter->Report( wxString::Format( _( "Downloading package url: '%s'" ), url ), + m_reporter->PCMReport( wxString::Format( _( "Downloading package url: '%s'" ), url ), RPT_SEVERITY_INFO ); int code = curl.Perform(); @@ -163,7 +163,7 @@ int PCM_TASK_MANAGER::downloadFile( const wxString& aFilePath, const wxString& u if( code != CURLE_OK && code != CURLE_ABORTED_BY_CALLBACK ) { - m_reporter->Report( wxString::Format( _( "Failed to download url %s\n%s" ), url, + m_reporter->PCMReport( wxString::Format( _( "Failed to download url %s\n%s" ), url, curl.GetErrorText( code ) ), RPT_SEVERITY_ERROR ); } @@ -187,7 +187,7 @@ bool PCM_TASK_MANAGER::extract( const wxString& aFilePath, const wxString& aPack if( !zip.IsOk() ) { - m_reporter->Report( _( "Error extracting file!" ), RPT_SEVERITY_ERROR ); + m_reporter->PCMReport( _( "Error extracting file!" ), RPT_SEVERITY_ERROR ); return false; } @@ -232,7 +232,7 @@ bool PCM_TASK_MANAGER::extract( const wxString& aFilePath, const wxString& aPack if( !( CopyStreamData( zip, out, entry->GetSize() ) && out.Commit() ) ) { - m_reporter->Report( _( "Error extracting file!" ), RPT_SEVERITY_ERROR ); + m_reporter->PCMReport( _( "Error extracting file!" ), RPT_SEVERITY_ERROR ); return false; } @@ -250,11 +250,11 @@ bool PCM_TASK_MANAGER::extract( const wxString& aFilePath, const wxString& aPack if( m_reporter->IsCancelled() ) { - m_reporter->Report( _( "Aborting package installation." ), RPT_SEVERITY_INFO ); + m_reporter->PCMReport( _( "Aborting package installation." ), RPT_SEVERITY_INFO ); return false; } - m_reporter->Report( _( "Extracted package\n" ), RPT_SEVERITY_INFO ); + m_reporter->PCMReport( _( "Extracted package\n" ), RPT_SEVERITY_INFO ); m_reporter->SetPackageProgress( entries, entries ); return true; @@ -360,12 +360,12 @@ void PCM_TASK_MANAGER::deletePackageDirectories( const wxString& aPackageId ) if( d.DirExists() ) { - m_reporter->Report( wxString::Format( _( "Removing directory %s" ), d.GetPath() ), + m_reporter->PCMReport( wxString::Format( _( "Removing directory %s" ), d.GetPath() ), RPT_SEVERITY_INFO ); if( !d.Rmdir( wxPATH_RMDIR_RECURSIVE ) ) { - m_reporter->Report( + m_reporter->PCMReport( wxString::Format( _( "Failed to remove directory %s" ), d.GetPath() ), RPT_SEVERITY_ERROR ); } @@ -382,7 +382,7 @@ void PCM_TASK_MANAGER::Uninstall( const PCM_PACKAGE& aPackage ) m_pcm->MarkUninstalled( aPackage ); - m_reporter->Report( wxString::Format( _( "Package %s uninstalled" ), aPackage.identifier ), + m_reporter->PCMReport( wxString::Format( _( "Package %s uninstalled" ), aPackage.identifier ), RPT_SEVERITY_INFO ); }; @@ -448,7 +448,7 @@ void PCM_TASK_MANAGER::RunQueue( wxWindow* aParent ) } while( ( !m_install_queue.empty() || !download_complete ) && !m_reporter->IsCancelled() ); - m_reporter->Report( _( "Done." ), RPT_SEVERITY_INFO ); + m_reporter->PCMReport( _( "Done." ), RPT_SEVERITY_INFO ); m_reporter->SetFinished(); } ); diff --git a/pcbnew/drc/drc_test_provider_zone_connections.cpp b/pcbnew/drc/drc_test_provider_zone_connections.cpp index 0b6f1d34b3..6c74405bc9 100644 --- a/pcbnew/drc/drc_test_provider_zone_connections.cpp +++ b/pcbnew/drc/drc_test_provider_zone_connections.cpp @@ -179,7 +179,6 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I bool DRC_TEST_PROVIDER_ZONE_CONNECTIONS::Run() { BOARD* board = m_drcEngine->GetBoard(); - BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings(); std::shared_ptr connectivity = board->GetConnectivity(); DRC_CONSTRAINT constraint;