The ERC code depends on netlist items to be sorted by net code, so verify
that in debug builds. While this condition is stricter than necessary, it
should still hold with the current code, and provide a good canary if a
change to the sorting code might break ERC.
---
eeschema/dialogs/dialog_erc.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 681a4db..acb3718 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -49,6 +49,9 @@
#include <erc.h>
#include <id.h>
+#include <wx/debug.h>
+
+
extern int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
extern int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
@@ -507,8 +510,12 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
for( unsigned item = 0; item < objectsConnectedList->size(); item++ )
{
- if( objectsConnectedList->GetItemNet( lastItem ) !=
- objectsConnectedList->GetItemNet( item ) )
+ auto lastNet = objectsConnectedList->GetItemNet( lastItem );
+ auto net = objectsConnectedList->GetItemNet( item );
+
+ wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
+
+ if( lastNet != net )
{
// New net found:
MinConn = NOC;
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp