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:
default:
wxFAIL_MSG( wxS( "Unknown ERC error code" ) );
return nullptr;
break;
}
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_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 );
}

View File

@ -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;

View File

@ -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() );
}

View File

@ -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() );
}

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
// it returns the right result in &value. Thus, ignore the return value.
aValue.ToCDouble(&value);
if( value == std::numeric_limits<double>::max() ) // conversion really failed
{
THROW_IO_ERROR( wxString::Format( _( "Cannot convert '%s' to an integer." ),
aValue.GetData() ) );
return 0;
}
return KiROUND( value * aScalar );