diff --git a/eeschema/erc_item.cpp b/eeschema/erc_item.cpp index 93eee24419..b5dbdd2515 100644 --- a/eeschema/erc_item.cpp +++ b/eeschema/erc_item.cpp @@ -271,7 +271,7 @@ std::shared_ptr ERC_ITEM::Create( int aErrorCode ) case ERCE_UNSPECIFIED: default: wxFAIL_MSG( wxS( "Unknown ERC error code" ) ); - return nullptr; + break; } return nullptr; diff --git a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp index b0f5fbf866..eb435fa236 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp @@ -738,11 +738,10 @@ FILL_T SCH_LEGACY_PLUGIN_CACHE::parseFillMode( LINE_READER& aReader, const char* case 'F': return FILL_T::FILLED_SHAPE; case 'f': return FILL_T::FILLED_WITH_BG_BODYCOLOR; case 'N': return FILL_T::NO_FILL; - default: SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine ); + default: break; } - // This will never be reached but quiets the compiler warnings - return FILL_T::NO_FILL; + SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine ); } diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index b4f456c493..3e47527cb0 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -1301,7 +1301,7 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) KICTL_EAGLE_BRD | KICTL_IMPORT_LIB ); default: - return false; + break; } return false; diff --git a/pcbnew/pcb_field.cpp b/pcbnew/pcb_field.cpp index 96459503a5..66d3b16429 100644 --- a/pcbnew/pcb_field.cpp +++ b/pcbnew/pcb_field.cpp @@ -114,14 +114,13 @@ wxString PCB_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const return wxString::Format( _( "Datasheet '%s' of %s" ), KIUI::EllipsizeMenuText( GetText() ), GetParentFootprint()->GetReference() ); - default: - return wxString::Format( _( "Field '%s' of %s" ), - KIUI::EllipsizeMenuText( GetText() ), - GetParentFootprint()->GetReference() ); + + default: + break; // avoid unreachable code / missing return statement warnings } - // Can't get here, but gcc doesn't seem to know that.... - return wxEmptyString; + return wxString::Format( _( "Field '%s' of %s" ), KIUI::EllipsizeMenuText( GetText() ), + GetParentFootprint()->GetReference() ); } diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp index 281cb90cc7..e46ad744f4 100644 --- a/pcbnew/pcb_text.cpp +++ b/pcbnew/pcb_text.cpp @@ -383,15 +383,10 @@ wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const return wxString::Format( _( "Footprint Text '%s' of %s" ), KIUI::EllipsizeMenuText( GetText() ), parentFP->GetReference() ); } - else - { - return wxString::Format( _( "PCB Text '%s' on %s"), - KIUI::EllipsizeMenuText( GetText() ), - GetLayerName() ); - } - - // Can't get here, but gcc doesn't seem to know that.... - return wxEmptyString; + + return wxString::Format( _( "PCB Text '%s' on %s" ), + KIUI::EllipsizeMenuText( GetText() ), + GetLayerName() ); } diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index 0257b7db56..48da4af166 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -85,11 +85,11 @@ static inline long parseInt( const wxString& aValue, double aScalar ) // This conversion reports failure on strings as simple as "1000", still // it returns the right result in &value. Thus, ignore the return value. aValue.ToCDouble(&value); + if( value == std::numeric_limits::max() ) // conversion really failed { THROW_IO_ERROR( wxString::Format( _( "Cannot convert '%s' to an integer." ), aValue.GetData() ) ); - return 0; } return KiROUND( value * aScalar );