Fix some unreachable code msvc warnings

This commit is contained in:
Roberto Fernandez Bautista 2023-07-16 15:40:44 +02:00
parent e7019cc7d2
commit cf0b719a4a
6 changed files with 14 additions and 21 deletions

View File

@ -271,7 +271,7 @@ std::shared_ptr<ERC_ITEM> ERC_ITEM::Create( int aErrorCode )
case ERCE_UNSPECIFIED: case ERCE_UNSPECIFIED:
default: default:
wxFAIL_MSG( wxS( "Unknown ERC error code" ) ); wxFAIL_MSG( wxS( "Unknown ERC error code" ) );
return nullptr; break;
} }
return nullptr; return nullptr;

View File

@ -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_SHAPE;
case 'f': return FILL_T::FILLED_WITH_BG_BODYCOLOR; case 'f': return FILL_T::FILLED_WITH_BG_BODYCOLOR;
case 'N': return FILL_T::NO_FILL; 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 SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine );
return FILL_T::NO_FILL;
} }

View File

@ -1301,7 +1301,7 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
KICTL_EAGLE_BRD | KICTL_IMPORT_LIB ); KICTL_EAGLE_BRD | KICTL_IMPORT_LIB );
default: default:
return false; break;
} }
return false; return false;

View File

@ -114,14 +114,13 @@ wxString PCB_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
return wxString::Format( _( "Datasheet '%s' of %s" ), return wxString::Format( _( "Datasheet '%s' of %s" ),
KIUI::EllipsizeMenuText( GetText() ), KIUI::EllipsizeMenuText( GetText() ),
GetParentFootprint()->GetReference() ); GetParentFootprint()->GetReference() );
default:
return wxString::Format( _( "Field '%s' of %s" ), default:
KIUI::EllipsizeMenuText( GetText() ), break; // avoid unreachable code / missing return statement warnings
GetParentFootprint()->GetReference() );
} }
// Can't get here, but gcc doesn't seem to know that.... return wxString::Format( _( "Field '%s' of %s" ), KIUI::EllipsizeMenuText( GetText() ),
return wxEmptyString; GetParentFootprint()->GetReference() );
} }

View File

@ -383,15 +383,10 @@ wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
return wxString::Format( _( "Footprint Text '%s' of %s" ), return wxString::Format( _( "Footprint Text '%s' of %s" ),
KIUI::EllipsizeMenuText( GetText() ), parentFP->GetReference() ); KIUI::EllipsizeMenuText( GetText() ), parentFP->GetReference() );
} }
else
{ return wxString::Format( _( "PCB Text '%s' on %s" ),
return wxString::Format( _( "PCB Text '%s' on %s"), KIUI::EllipsizeMenuText( GetText() ),
KIUI::EllipsizeMenuText( GetText() ), GetLayerName() );
GetLayerName() );
}
// Can't get here, but gcc doesn't seem to know that....
return wxEmptyString;
} }

View File

@ -85,11 +85,11 @@ static inline long parseInt( const wxString& aValue, double aScalar )
// This conversion reports failure on strings as simple as "1000", still // This conversion reports failure on strings as simple as "1000", still
// it returns the right result in &value. Thus, ignore the return value. // it returns the right result in &value. Thus, ignore the return value.
aValue.ToCDouble(&value); aValue.ToCDouble(&value);
if( value == std::numeric_limits<double>::max() ) // conversion really failed if( value == std::numeric_limits<double>::max() ) // conversion really failed
{ {
THROW_IO_ERROR( wxString::Format( _( "Cannot convert '%s' to an integer." ), THROW_IO_ERROR( wxString::Format( _( "Cannot convert '%s' to an integer." ),
aValue.GetData() ) ); aValue.GetData() ) );
return 0;
} }
return KiROUND( value * aScalar ); return KiROUND( value * aScalar );