From dad842d3f03baa0a52a606aa8e5939605cd04c2f Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Fri, 22 Dec 2023 19:08:14 -0500 Subject: [PATCH] Allow no-connects on standalone hierarchical pins/ports Fixes https://gitlab.com/kicad/code/kicad/-/issues/16397 --- eeschema/connection_graph.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index f3d0a111c2..c711935136 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -3244,7 +3244,6 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH } -// TODO(JE) Check sheet pins here too? bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph ) { ERC_SETTINGS& settings = m_schematic->ErcSettings(); @@ -3314,6 +3313,23 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph if( aSubgraph->m_no_connect != nullptr ) { + // Special case: If the subgraph being checked consists of only a hier port/pin and + // a no-connect, we don't issue a "no-connect connected" warning just because + // connections exist on the sheet on the other side of the link. + VECTOR2I noConnectPos = aSubgraph->m_no_connect->GetPosition(); + + for( SCH_SHEET_PIN* hierPin : aSubgraph->m_hier_pins ) + { + if( hierPin->GetPosition() == noConnectPos ) + return true; + } + + for( SCH_HIERLABEL* hierLabel : aSubgraph->m_hier_ports ) + { + if( hierLabel->GetPosition() == noConnectPos ) + return true; + } + if( unique_pins.size() > 1 && settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) ) { std::shared_ptr ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_CONNECTED );