@ -290,7 +290,7 @@ void CONNECTION_SUBGRAPH::getAllConnectedItems( std::set<std::pair<SCH_SHEET_PAT
while ( sg - > m_absorbed_by )
{
wxASSERT ( sg - > m_graph = = sg - > m_absorbed_by - > m_graph ) ;
wxCHECK2 ( sg - > m_graph = = sg - > m_absorbed_by - > m_graph , continue ) ;
sg = sg - > m_absorbed_by ;
}
@ -494,7 +494,7 @@ CONNECTION_SUBGRAPH::GetNetclassesForDriver( SCH_ITEM* aItem ) const
void CONNECTION_SUBGRAPH : : Absorb ( CONNECTION_SUBGRAPH * aOther )
{
wxASSERT ( m_sheet = = aOther - > m_sheet ) ;
wxCHECK ( m_sheet = = aOther - > m_sheet , /* void */ ) ;
for ( SCH_ITEM * item : aOther - > m_items )
{
@ -870,6 +870,7 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
// Find the primary subgraph on this sheet
while ( aSubgraph - > m_absorbed_by )
{
// Should we skip this if the absorbed by sub-graph is not this sub-grap?
wxASSERT ( aSubgraph - > m_graph = = aSubgraph - > m_absorbed_by - > m_graph ) ;
aSubgraph = aSubgraph - > m_absorbed_by ;
}
@ -877,6 +878,7 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
// Find the top most connected subgraph on all sheets
while ( aSubgraph - > m_hier_parent )
{
// Should we skip this if the absorbed by sub-graph is not this sub-grap?
wxASSERT ( aSubgraph - > m_graph = = aSubgraph - > m_hier_parent - > m_graph ) ;
aSubgraph = aSubgraph - > m_hier_parent ;
}
@ -1467,7 +1469,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
SCH_CONNECTION * connected_conn = connected_item - > Connection ( & sheet ) ;
wxASSERT ( connected_conn ) ;
wxCHECK2 ( connected_conn , continue ) ;
if ( connected_conn - > SubgraphCode ( ) = = 0 )
{
@ -2071,6 +2073,7 @@ void CONNECTION_GRAPH::processSubGraphs()
}
else
{
// Should we skip this if the driver type is not one of these types?
wxASSERT ( driver - > Type ( ) = = SCH_LABEL_T | |
driver - > Type ( ) = = SCH_GLOBAL_LABEL_T | |
driver - > Type ( ) = = SCH_HIER_LABEL_T ) ;
@ -2299,6 +2302,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
for ( CONNECTION_SUBGRAPH * subgraph : m_driver_subgraphs )
{
// All SGs should have been processed by propagateToNeighbors above
// Should we skip all of this if the subgraph is not dirty?
wxASSERT_MSG ( ! subgraph - > m_dirty ,
wxS ( " Subgraph not processed by propagateToNeighbors! " ) ) ;
@ -2310,6 +2314,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
wxLogTrace ( ConnTrace , wxS ( " %lu (%s) has multiple bus parents " ) ,
subgraph - > m_code , conn - > Name ( ) ) ;
// Should we skip everything after this if this is not a net?
wxASSERT ( conn - > IsNet ( ) ) ;
for ( const auto & ii : subgraph - > m_bus_parents )
@ -2659,6 +2664,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
candidate - > m_hier_parent = aParent ;
aParent - > m_hier_children . insert ( candidate ) ;
// Should we skip adding the candidate to the list if the parent and candidate subgraphs
// are not the same?
wxASSERT ( candidate - > m_graph = = aParent - > m_graph ) ;
search_list . push_back ( candidate ) ;
@ -2777,7 +2784,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
continue ;
// Safety check against infinite recursion
wxASSERT ( neighbor_conn - > IsNet ( ) ) ;
wxCHECK2_MSG ( neighbor_conn - > IsNet ( ) , continue ,
wxS ( " \" " ) + neighbor_name + wxS ( " \" is not a net. " ) ) ;
wxLogTrace ( ConnTrace , wxS ( " %lu (%s) connected to bus member %s (local %s) " ) ,
neighbor - > m_code , neighbor_name , member - > Name ( ) , member - > LocalName ( ) ) ;
@ -2987,6 +2995,7 @@ std::shared_ptr<SCH_CONNECTION> CONNECTION_GRAPH::getDefaultConnection( SCH_ITEM
SCH_CONNECTION * CONNECTION_GRAPH : : matchBusMember ( SCH_CONNECTION * aBusConnection ,
SCH_CONNECTION * aSearch )
{
// Should we return a null pointer if the connection is not a bus connection?
wxASSERT ( aBusConnection - > IsBus ( ) ) ;
SCH_CONNECTION * match = nullptr ;
@ -3069,6 +3078,7 @@ std::vector<const CONNECTION_SUBGRAPH*> CONNECTION_GRAPH::GetBusesNeedingMigrati
for ( CONNECTION_SUBGRAPH * subgraph : m_subgraphs )
{
// Graph is supposed to be up-to-date before calling this
// Should we continue if the subgraph is not up to date?
wxASSERT ( ! subgraph - > m_dirty ) ;
if ( ! subgraph - > m_driver )
@ -3148,6 +3158,7 @@ CONNECTION_SUBGRAPH* CONNECTION_GRAPH::FindSubgraphByName( const wxString& aNetN
for ( CONNECTION_SUBGRAPH * sg : it - > second )
{
// Cache is supposed to be valid by now
// Should we continue if the cache is not valid?
wxASSERT ( sg & & ! sg - > m_absorbed & & sg - > m_driver_connection ) ;
if ( sg - > m_sheet = = aPath & & sg - > m_driver_connection - > Name ( ) = = aNetName )
@ -3165,6 +3176,7 @@ CONNECTION_SUBGRAPH* CONNECTION_GRAPH::FindFirstSubgraphByName( const wxString&
if ( it = = m_net_name_to_subgraphs_map . end ( ) )
return nullptr ;
// Should this return a nullptr if the map entry is empty?
wxASSERT ( ! it - > second . empty ( ) ) ;
return it - > second [ 0 ] ;
@ -3215,6 +3227,7 @@ int CONNECTION_GRAPH::RunERC()
wxCHECK2 ( subgraph , continue ) ;
// Graph is supposed to be up-to-date before calling RunERC()
// Should we continue if the subgraph is not up to date?
wxASSERT ( ! subgraph - > m_dirty ) ;
if ( subgraph - > m_absorbed )
@ -3522,6 +3535,7 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
{
bus_wire = bus_entry - > m_connected_bus_item ;
// Should we continue if the type is not a line?
wxASSERT ( bus_wire - > Type ( ) = = SCH_LINE_T ) ;
// In some cases, the connection list (SCH_CONNECTION*) can be null.