7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Get rid of C++20 compiler warnings.

This commit is contained in:
Jeff Young 2024-07-03 13:25:23 +01:00
parent aa5a370b3a
commit 9d03a92738
19 changed files with 183 additions and 106 deletions

View File

@ -458,9 +458,14 @@ public:
return ( this == &aItem ) ? 1.0 : 0.0;
}
bool operator==( const BOARD_ITEM& aItem ) const override
bool operator==( const BOARD_ITEM& aBoardItem ) const override
{
return ( this == &aItem );
return ( this == &aBoardItem );
}
bool operator==( const DELETED_BOARD_ITEM& aOther ) const
{
return ( this == &aOther );
}
#if defined(DEBUG)

View File

@ -2301,92 +2301,98 @@ void PAD::CheckPad( UNITS_PROVIDER* aUnitsProvider,
}
bool PAD::operator==( const BOARD_ITEM& aOther ) const
bool PAD::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( Type() != aOther.Type() )
if( Type() != aBoardItem.Type() )
return false;
if( m_parent && aOther.GetParent() && m_parent->m_Uuid != aOther.GetParent()->m_Uuid )
if( m_parent && aBoardItem.GetParent() && m_parent->m_Uuid != aBoardItem.GetParent()->m_Uuid )
return false;
const PAD& other = static_cast<const PAD&>( aOther );
const PAD& other = static_cast<const PAD&>( aBoardItem );
if( GetShape() != other.GetShape() )
return *this == other;
}
bool PAD::operator==( const PAD& aOther ) const
{
if( GetShape() != aOther.GetShape() )
return false;
if( GetPosition() != other.GetPosition() )
if( GetPosition() != aOther.GetPosition() )
return false;
if( GetAttribute() != other.GetAttribute() )
if( GetAttribute() != aOther.GetAttribute() )
return false;
if( GetSize() != other.GetSize() )
if( GetSize() != aOther.GetSize() )
return false;
if( GetOffset() != other.GetOffset() )
if( GetOffset() != aOther.GetOffset() )
return false;
if( GetDrillSize() != other.GetDrillSize() )
if( GetDrillSize() != aOther.GetDrillSize() )
return false;
if( GetDrillShape() != other.GetDrillShape() )
if( GetDrillShape() != aOther.GetDrillShape() )
return false;
if( GetRoundRectRadiusRatio() != other.GetRoundRectRadiusRatio() )
if( GetRoundRectRadiusRatio() != aOther.GetRoundRectRadiusRatio() )
return false;
if( GetChamferRectRatio() != other.GetChamferRectRatio() )
if( GetChamferRectRatio() != aOther.GetChamferRectRatio() )
return false;
if( GetChamferPositions() != other.GetChamferPositions() )
if( GetChamferPositions() != aOther.GetChamferPositions() )
return false;
if( GetOrientation() != other.GetOrientation() )
if( GetOrientation() != aOther.GetOrientation() )
return false;
if( GetLocalZoneConnection() != other.GetLocalZoneConnection() )
if( GetLocalZoneConnection() != aOther.GetLocalZoneConnection() )
return false;
if( GetThermalSpokeWidth() != other.GetThermalSpokeWidth() )
if( GetThermalSpokeWidth() != aOther.GetThermalSpokeWidth() )
return false;
if( GetThermalSpokeAngle() != other.GetThermalSpokeAngle() )
if( GetThermalSpokeAngle() != aOther.GetThermalSpokeAngle() )
return false;
if( GetThermalGap() != other.GetThermalGap() )
if( GetThermalGap() != aOther.GetThermalGap() )
return false;
if( GetCustomShapeInZoneOpt() != other.GetCustomShapeInZoneOpt() )
if( GetCustomShapeInZoneOpt() != aOther.GetCustomShapeInZoneOpt() )
return false;
if( GetPrimitives().size() != other.GetPrimitives().size() )
if( GetPrimitives().size() != aOther.GetPrimitives().size() )
return false;
for( size_t ii = 0; ii < GetPrimitives().size(); ii++ )
{
if( *GetPrimitives()[ii] != *other.GetPrimitives()[ii] )
if( *GetPrimitives()[ii] != *aOther.GetPrimitives()[ii] )
return false;
}
if( GetAnchorPadShape() != other.GetAnchorPadShape() )
if( GetAnchorPadShape() != aOther.GetAnchorPadShape() )
return false;
if( GetLocalClearance() != other.GetLocalClearance() )
if( GetLocalClearance() != aOther.GetLocalClearance() )
return false;
if( GetLocalSolderMaskMargin() != other.GetLocalSolderMaskMargin() )
if( GetLocalSolderMaskMargin() != aOther.GetLocalSolderMaskMargin() )
return false;
if( GetLocalSolderPasteMargin() != other.GetLocalSolderPasteMargin() )
if( GetLocalSolderPasteMargin() != aOther.GetLocalSolderPasteMargin() )
return false;
if( GetLocalSolderPasteMarginRatio() != other.GetLocalSolderPasteMarginRatio() )
if( GetLocalSolderPasteMarginRatio() != aOther.GetLocalSolderPasteMarginRatio() )
return false;
if( GetLocalSpokeWidthOverride() != other.GetLocalSpokeWidthOverride() )
if( GetLocalSpokeWidthOverride() != aOther.GetLocalSpokeWidthOverride() )
return false;
if( GetLayerSet() != other.GetLayerSet() )
if( GetLayerSet() != aOther.GetLayerSet() )
return false;
return true;

View File

@ -830,8 +830,8 @@ public:
double Similarity( const BOARD_ITEM& aOther ) const override;
bool operator==( const BOARD_ITEM& aOther ) const override;
bool operator!=( const BOARD_ITEM& aOther ) const { return !operator==( aOther ); }
bool operator==( const PAD& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }

View File

@ -71,40 +71,46 @@ bool PCB_DIMENSION_BASE::operator==( const BOARD_ITEM& aOther ) const
const PCB_DIMENSION_BASE& other = static_cast<const PCB_DIMENSION_BASE&>( aOther );
if( m_textPosition != other.m_textPosition )
return *this == other;
}
bool PCB_DIMENSION_BASE::operator==( const PCB_DIMENSION_BASE& aOther ) const
{
if( m_textPosition != aOther.m_textPosition )
return false;
if( m_keepTextAligned != other.m_keepTextAligned )
if( m_keepTextAligned != aOther.m_keepTextAligned )
return false;
if( m_units != other.m_units )
if( m_units != aOther.m_units )
return false;
if( m_autoUnits != other.m_autoUnits )
if( m_autoUnits != aOther.m_autoUnits )
return false;
if( m_unitsFormat != other.m_unitsFormat )
if( m_unitsFormat != aOther.m_unitsFormat )
return false;
if( m_precision != other.m_precision )
if( m_precision != aOther.m_precision )
return false;
if( m_suppressZeroes != other.m_suppressZeroes )
if( m_suppressZeroes != aOther.m_suppressZeroes )
return false;
if( m_lineThickness != other.m_lineThickness )
if( m_lineThickness != aOther.m_lineThickness )
return false;
if( m_arrowLength != other.m_arrowLength )
if( m_arrowLength != aOther.m_arrowLength )
return false;
if( m_extensionOffset != other.m_extensionOffset )
if( m_extensionOffset != aOther.m_extensionOffset )
return false;
if( m_measuredValue != other.m_measuredValue )
if( m_measuredValue != aOther.m_measuredValue )
return false;
return EDA_TEXT::operator==( other );
return EDA_TEXT::operator==( aOther );
}

View File

@ -288,7 +288,8 @@ public:
double Similarity( const BOARD_ITEM& aOther ) const override;
bool operator==( const BOARD_ITEM& aOther ) const override;
bool operator==( const PCB_DIMENSION_BASE& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }

View File

@ -426,20 +426,26 @@ void PCB_GROUP::RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFun
}
bool PCB_GROUP::operator==( const BOARD_ITEM& aOther ) const
bool PCB_GROUP::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_GROUP& other = static_cast<const PCB_GROUP&>( aOther );
const PCB_GROUP& other = static_cast<const PCB_GROUP&>( aBoardItem );
if( m_items.size() != other.m_items.size() )
return *this == other;
}
bool PCB_GROUP::operator==( const PCB_GROUP& aOther ) const
{
if( m_items.size() != aOther.m_items.size() )
return false;
// The items in groups are in unordered sets hashed by the pointer value, so we need to
// order them by UUID (EDA_ITEM_SET) to compare
EDA_ITEM_SET itemSet( m_items.begin(), m_items.end() );
EDA_ITEM_SET otherItemSet( other.m_items.begin(), other.m_items.end() );
EDA_ITEM_SET otherItemSet( aOther.m_items.begin(), aOther.m_items.end() );
for( auto it1 = itemSet.begin(), it2 = otherItemSet.begin(); it1 != itemSet.end(); ++it1, ++it2 )
{

View File

@ -104,7 +104,8 @@ public:
double Similarity( const BOARD_ITEM& aOther ) const override;
bool operator==( const BOARD_ITEM& aOther ) const override;
bool operator==( const PCB_GROUP& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
#if defined( DEBUG )
void Show( int nestLevel, std::ostream& os ) const override

View File

@ -269,32 +269,38 @@ void PCB_REFERENCE_IMAGE::ViewGetLayers( int aLayers[], int& aCount ) const
}
bool PCB_REFERENCE_IMAGE::operator==( const BOARD_ITEM& aOther ) const
bool PCB_REFERENCE_IMAGE::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_REFERENCE_IMAGE& other = static_cast<const PCB_REFERENCE_IMAGE&>( aOther );
const PCB_REFERENCE_IMAGE& other = static_cast<const PCB_REFERENCE_IMAGE&>( aBoardItem );
if( m_layer != other.m_layer )
return *this == other;
}
bool PCB_REFERENCE_IMAGE::operator==( const PCB_REFERENCE_IMAGE& aOther ) const
{
if( m_layer != aOther.m_layer )
return false;
if( m_pos != other.m_pos )
if( m_pos != aOther.m_pos )
return false;
if( m_bitmapBase->GetSize() != other.m_bitmapBase->GetSize() )
if( m_bitmapBase->GetSize() != aOther.m_bitmapBase->GetSize() )
return false;
if( m_bitmapBase->GetPPI() != other.m_bitmapBase->GetPPI() )
if( m_bitmapBase->GetPPI() != aOther.m_bitmapBase->GetPPI() )
return false;
if( m_bitmapBase->GetScale() != other.m_bitmapBase->GetScale() )
if( m_bitmapBase->GetScale() != aOther.m_bitmapBase->GetScale() )
return false;
if( m_bitmapBase->GetImageID() != other.m_bitmapBase->GetImageID() )
if( m_bitmapBase->GetImageID() != aOther.m_bitmapBase->GetImageID() )
return false;
if( m_bitmapBase->GetImageData() != other.m_bitmapBase->GetImageData() )
if( m_bitmapBase->GetImageData() != aOther.m_bitmapBase->GetImageData() )
return false;
return true;

View File

@ -139,6 +139,7 @@ public:
double Similarity( const BOARD_ITEM& aBoardItem ) const override;
bool operator==( const PCB_REFERENCE_IMAGE& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
#if defined( DEBUG )

View File

@ -438,46 +438,52 @@ int PCB_TABLE::Compare( const PCB_TABLE* aTable, const PCB_TABLE* aOther )
}
bool PCB_TABLE::operator==( const BOARD_ITEM& aOther ) const
bool PCB_TABLE::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( Type() != aOther.Type() )
if( Type() != aBoardItem.Type() )
return false;
const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aOther );
const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aBoardItem );
if( m_cells.size() != other.m_cells.size() )
return *this == other;
}
bool PCB_TABLE::operator==( const PCB_TABLE& aOther ) const
{
if( m_cells.size() != aOther.m_cells.size() )
return false;
if( m_strokeExternal != other.m_strokeExternal )
if( m_strokeExternal != aOther.m_strokeExternal )
return false;
if( m_strokeHeader != other.m_strokeHeader )
if( m_strokeHeader != aOther.m_strokeHeader )
return false;
if( m_borderStroke != other.m_borderStroke )
if( m_borderStroke != aOther.m_borderStroke )
return false;
if( m_strokeRows != other.m_strokeRows )
if( m_strokeRows != aOther.m_strokeRows )
return false;
if( m_strokeColumns != other.m_strokeColumns )
if( m_strokeColumns != aOther.m_strokeColumns )
return false;
if( m_separatorsStroke != other.m_separatorsStroke )
if( m_separatorsStroke != aOther.m_separatorsStroke )
return false;
if( m_orientation != other.m_orientation )
if( m_orientation != aOther.m_orientation )
return false;
if( m_colWidths != other.m_colWidths )
if( m_colWidths != aOther.m_colWidths )
return false;
if( m_rowHeights != other.m_rowHeights )
if( m_rowHeights != aOther.m_rowHeights )
return false;
for( int ii = 0; ii < (int) m_cells.size(); ++ii )
{
if( !( *m_cells[ii] == *other.m_cells[ii] ) )
if( !( *m_cells[ii] == *aOther.m_cells[ii] ) )
return false;
}

View File

@ -229,7 +229,8 @@ public:
double Similarity( const BOARD_ITEM& aOther ) const override;
bool operator==( const BOARD_ITEM& aOther ) const override;
bool operator==( const PCB_TABLE& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
static int Compare( const PCB_TABLE* aTable, const PCB_TABLE* aOther );

View File

@ -189,15 +189,24 @@ void PCB_TARGET::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID
}
bool PCB_TARGET::operator==( const BOARD_ITEM& aOther ) const
bool PCB_TARGET::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_TARGET& other = static_cast<const PCB_TARGET&>( aOther );
const PCB_TARGET& other = static_cast<const PCB_TARGET&>( aBoardItem );
return m_shape == other.m_shape && m_size == other.m_size && m_lineWidth == other.m_lineWidth
&& m_layer == other.m_layer && m_pos == other.m_pos;
return *this == other;
}
bool PCB_TARGET::operator==( const PCB_TARGET& aOther ) const
{
return m_shape == aOther.m_shape
&& m_size == aOther.m_size
&& m_lineWidth == aOther.m_lineWidth
&& m_layer == aOther.m_layer
&& m_pos == aOther.m_pos;
}

View File

@ -112,6 +112,7 @@ public:
double Similarity( const BOARD_ITEM& aBoardItem ) const override;
bool operator==( const PCB_TARGET& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
#if defined(DEBUG)

View File

@ -636,14 +636,20 @@ void PCB_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aL
}
bool PCB_TEXT::operator==( const BOARD_ITEM& aOther ) const
bool PCB_TEXT::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_TEXT& other = static_cast<const PCB_TEXT&>( aOther );
const PCB_TEXT& other = static_cast<const PCB_TEXT&>( aBoardItem );
return EDA_TEXT::operator==( other );
return *this == other;
}
bool PCB_TEXT::operator==( const PCB_TEXT& aOther ) const
{
return EDA_TEXT::operator==( aOther );
}

View File

@ -166,6 +166,7 @@ public:
double Similarity( const BOARD_ITEM& aBoardItem ) const override;
bool operator==( const PCB_TEXT& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
#if defined(DEBUG)

View File

@ -635,7 +635,6 @@ void PCB_TEXTBOX::SetBorderWidth( const int aSize )
}
bool PCB_TEXTBOX::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aBoardItem.Type() != Type() )
@ -643,7 +642,14 @@ bool PCB_TEXTBOX::operator==( const BOARD_ITEM& aBoardItem ) const
const PCB_TEXTBOX& other = static_cast<const PCB_TEXTBOX&>( aBoardItem );
return m_borderEnabled == other.m_borderEnabled && EDA_TEXT::operator==( other );
return *this == other;
}
bool PCB_TEXTBOX::operator==( const PCB_TEXTBOX& aOther ) const
{
return m_borderEnabled == aOther.m_borderEnabled
&& EDA_TEXT::operator==( aOther );
}

View File

@ -161,6 +161,7 @@ public:
double Similarity( const BOARD_ITEM& aBoardItem ) const override;
bool operator==( const PCB_TEXTBOX& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
protected:

View File

@ -157,12 +157,12 @@ BITMAPS PCB_VIA::GetMenuImage() const
}
bool PCB_TRACK::operator==( const BOARD_ITEM& aOther ) const
bool PCB_TRACK::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_TRACK& other = static_cast<const PCB_TRACK&>( aOther );
const PCB_TRACK& other = static_cast<const PCB_TRACK&>( aBoardItem );
return *this == other;
}
@ -171,9 +171,9 @@ bool PCB_TRACK::operator==( const BOARD_ITEM& aOther ) const
bool PCB_TRACK::operator==( const PCB_TRACK& aOther ) const
{
return m_Start == aOther.m_Start
&& m_End == aOther.m_End
&& m_layer == aOther.m_layer
&& m_Width == aOther.m_Width;
&& m_End == aOther.m_End
&& m_layer == aOther.m_layer
&& m_Width == aOther.m_Width;
}
@ -202,15 +202,24 @@ double PCB_TRACK::Similarity( const BOARD_ITEM& aOther ) const
}
bool PCB_ARC::operator==( const BOARD_ITEM& aOther ) const
bool PCB_ARC::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_ARC& other = static_cast<const PCB_ARC&>( aOther );
const PCB_ARC& other = static_cast<const PCB_ARC&>( aBoardItem );
return m_Start == other.m_Start && m_End == other.m_End && m_Mid == other.m_Mid &&
m_layer == other.m_layer && m_Width == other.m_Width;
return *this == other;
}
bool PCB_ARC::operator==( const PCB_ARC& aOther ) const
{
return m_Start == aOther.m_Start
&& m_End == aOther.m_End
&& m_Mid == aOther.m_Mid
&& m_layer == aOther.m_layer
&& m_Width == aOther.m_Width;
}
@ -242,12 +251,12 @@ double PCB_ARC::Similarity( const BOARD_ITEM& aOther ) const
}
bool PCB_VIA::operator==( const BOARD_ITEM& aOther ) const
bool PCB_VIA::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aOther.Type() != Type() )
if( aBoardItem.Type() != Type() )
return false;
const PCB_VIA& other = static_cast<const PCB_VIA&>( aOther );
const PCB_VIA& other = static_cast<const PCB_VIA&>( aBoardItem );
return *this == other;
}
@ -255,9 +264,13 @@ bool PCB_VIA::operator==( const BOARD_ITEM& aOther ) const
bool PCB_VIA::operator==( const PCB_VIA& aOther ) const
{
return m_Start == aOther.m_Start && m_End == aOther.m_End && m_layer == aOther.m_layer
&& m_padStack == aOther.m_padStack && m_Width == aOther.m_Width
&& m_viaType == aOther.m_viaType && m_zoneLayerOverrides == aOther.m_zoneLayerOverrides;
return m_Start == aOther.m_Start
&& m_End == aOther.m_End
&& m_layer == aOther.m_layer
&& m_padStack == aOther.m_padStack
&& m_Width == aOther.m_Width
&& m_viaType == aOther.m_viaType
&& m_zoneLayerOverrides == aOther.m_zoneLayerOverrides;
}

View File

@ -328,7 +328,8 @@ public:
double Similarity( const BOARD_ITEM& aOther ) const override;
bool operator==( const BOARD_ITEM& aOther ) const override;
bool operator==( const PCB_ARC& aOther ) const;
bool operator==( const BOARD_ITEM& aBoardItem ) const override;
void Serialize( google::protobuf::Any &aContainer ) const override;
bool Deserialize( const google::protobuf::Any &aContainer ) override;