From d951ac5bfe05c7d0f93130bfee3d43c5cc615141 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 18 Feb 2021 12:10:51 -0500 Subject: [PATCH] Fix logic issue with sheet pin ERC Fixes https://gitlab.com/kicad/code/kicad/-/issues/7592 --- eeschema/connection_graph.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 26e5bd1285..b73ba40c7c 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -2837,6 +2837,8 @@ int CONNECTION_GRAPH::ercCheckHierSheets() } } + std::set matchedPins; + for( SCH_ITEM* subItem : parentSheet->GetScreen()->Items() ) { if( subItem->Type() == SCH_HIER_LABEL_T ) @@ -2845,11 +2847,14 @@ int CONNECTION_GRAPH::ercCheckHierSheets() if( !pins.count( label->GetText() ) ) labels[label->GetText()] = label; - - pins.erase( label->GetText() ); + else + matchedPins.insert( label->GetText() ); } } + for( const wxString& matched : matchedPins ) + pins.erase( matched ); + for( const std::pair& unmatched : pins ) { wxString msg = wxString::Format( _( "Sheet pin %s has no matching hierarchical " @@ -2870,7 +2875,7 @@ int CONNECTION_GRAPH::ercCheckHierSheets() for( const std::pair& unmatched : labels ) { wxString msg = wxString::Format( _( "Hierarchical label %s has no matching " - "sheet pin outside the sheet" ), + "sheet pin in the parent sheet" ), UnescapeString( unmatched.first ) ); std::shared_ptr ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );