kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #24922
[PATCH 06/16] Check sorting of netlist during ERC
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 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 90ff1e9..db4596b 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];
@@ -510,7 +513,12 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
auto item = objectsConnectedList->GetItem( item_idx );
auto lastItem = objectsConnectedList->GetItem( lastItem_idx );
- if( lastItem->GetNet() != item->GetNet() )
+ auto lastNet = lastItem->GetNet();
+ auto net = item->GetNet();
+
+ wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
+
+ if( lastNet != net )
{
// New net found:
MinConn = NOC;
Follow ups
References