Make sure ERC pin-to-pin checks are always in same order.
Comparing U1.pin1 : U2.pin1 will return the same
results as U2.pin1 : U1.pin1, but will result in a
different serialization of any exclusions.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17004
(cherry picked from commit 11193d2cda
)
This commit is contained in:
parent
c6215b08ed
commit
412da66cf6
|
@ -705,6 +705,21 @@ int ERC_TESTER::TestPinToPin()
|
|||
}
|
||||
}
|
||||
|
||||
std::sort( pins.begin(), pins.end(),
|
||||
[]( const ERC_SCH_PIN_CONTEXT& lhs, const ERC_SCH_PIN_CONTEXT& rhs )
|
||||
{
|
||||
int ret = StrNumCmp( lhs.Pin()->GetParentSymbol()->GetRef( &lhs.Sheet() ),
|
||||
rhs.Pin()->GetParentSymbol()->GetRef( &rhs.Sheet() ) );
|
||||
|
||||
if( ret == 0 )
|
||||
ret = StrNumCmp( lhs.Pin()->GetNumber(), rhs.Pin()->GetNumber() );
|
||||
|
||||
if( ret == 0 )
|
||||
ret = lhs < rhs; // Fallback to hash to guarantee deterministic sort
|
||||
|
||||
return ret < 0;
|
||||
} );
|
||||
|
||||
ERC_SCH_PIN_CONTEXT needsDriver;
|
||||
bool hasDriver = false;
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
#include <erc_sch_pin_context.h>
|
||||
|
||||
|
||||
SCH_PIN* ERC_SCH_PIN_CONTEXT::Pin()
|
||||
SCH_PIN* ERC_SCH_PIN_CONTEXT::Pin() const
|
||||
{
|
||||
return m_pin;
|
||||
}
|
||||
|
||||
|
||||
SCH_SHEET_PATH& ERC_SCH_PIN_CONTEXT::Sheet()
|
||||
const SCH_SHEET_PATH& ERC_SCH_PIN_CONTEXT::Sheet() const
|
||||
{
|
||||
return m_sheet;
|
||||
}
|
||||
|
|
|
@ -56,12 +56,12 @@ public:
|
|||
/**
|
||||
* Get the SCH_PIN for this context.
|
||||
*/
|
||||
SCH_PIN* Pin();
|
||||
SCH_PIN* Pin() const;
|
||||
|
||||
/**
|
||||
* Get the #SCH_SHEET_PATH context for the paired #SCH_PIN.
|
||||
*/
|
||||
SCH_SHEET_PATH& Sheet();
|
||||
const SCH_SHEET_PATH& Sheet() const;
|
||||
|
||||
/**
|
||||
* Test two pin contexts for equality based on the deterministic hash.
|
||||
|
|
Loading…
Reference in New Issue