From 8c6c87eaf4ceff5d7cc02e0aa575429955520bcd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 11 Jan 2022 21:13:41 +0000 Subject: [PATCH] Separate footprint lib issues from footprint mismatch issues. Fixes https://gitlab.com/kicad/code/kicad/issues/10132 --- pcbnew/drc/drc_item.cpp | 8 +++++++- pcbnew/drc/drc_item.h | 4 +++- .../drc/drc_test_provider_library_parity.cpp | 18 ++++++++++++------ qa/pcbnew/drc/test_drc_regressions.cpp | 1 + qa/pcbnew/test_tracks_cleaner.cpp | 1 + 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pcbnew/drc/drc_item.cpp b/pcbnew/drc/drc_item.cpp index a92a0f61f8..54a1169ad4 100644 --- a/pcbnew/drc/drc_item.cpp +++ b/pcbnew/drc/drc_item.cpp @@ -177,9 +177,13 @@ DRC_ITEM DRC_ITEM::netConflict( DRCE_NET_CONFLICT, wxT( "net_conflict" ) ); DRC_ITEM DRC_ITEM::libFootprintIssues( DRCE_LIB_FOOTPRINT_ISSUES, - _( "Library footprint issue" ), + _( "Footprint not found in libraries" ), wxT( "lib_footprint_issues" ) ); +DRC_ITEM DRC_ITEM::libFootprintMismatch( DRCE_LIB_FOOTPRINT_MISMATCH, + _( "Footprint doesn't match copy in library" ), + wxT( "lib_footprint_mismatch" ) ); + DRC_ITEM DRC_ITEM::unresolvedVariable( DRCE_UNRESOLVED_VARIABLE, _( "Unresolved text variable" ), wxT( "unresolved_variable" ) ); @@ -297,6 +301,7 @@ std::vector> DRC_ITEM::allItemTypes( { DRC_ITEM::footprintTypeMismatch, DRC_ITEM::libFootprintIssues, + DRC_ITEM::libFootprintMismatch, DRC_ITEM::footprintTHPadhasNoHole } ); @@ -338,6 +343,7 @@ std::shared_ptr DRC_ITEM::Create( int aErrorCode ) case DRCE_NET_CONFLICT: return std::make_shared( netConflict ); case DRCE_EXTRA_FOOTPRINT: return std::make_shared( extraFootprint ); case DRCE_LIB_FOOTPRINT_ISSUES: return std::make_shared( libFootprintIssues ); + case DRCE_LIB_FOOTPRINT_MISMATCH: return std::make_shared( libFootprintMismatch ); case DRCE_UNRESOLVED_VARIABLE: return std::make_shared( unresolvedVariable ); case DRCE_ASSERTION_FAILURE: return std::make_shared( assertionFailure ); case DRCE_COPPER_SLIVER: return std::make_shared( copperSliver ); diff --git a/pcbnew/drc/drc_item.h b/pcbnew/drc/drc_item.h index 865f9a52bf..3cad58440f 100644 --- a/pcbnew/drc/drc_item.h +++ b/pcbnew/drc/drc_item.h @@ -72,7 +72,8 @@ enum PCB_DRC_CODE { DRCE_NET_CONFLICT, // pad net doesn't match netlist DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads - DRCE_LIB_FOOTPRINT_ISSUES, // footprint does not match the current library + DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries + DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole DRCE_UNRESOLVED_VARIABLE, @@ -180,6 +181,7 @@ private: static DRC_ITEM extraFootprint; static DRC_ITEM netConflict; static DRC_ITEM libFootprintIssues; + static DRC_ITEM libFootprintMismatch; static DRC_ITEM unresolvedVariable; static DRC_ITEM assertionFailure; static DRC_ITEM copperSliver; diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index d824e058d9..1f19f6f8d5 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -40,6 +40,7 @@ Errors generated: - DRCE_LIB_FOOTPRINT_ISSUES + - DRCE_LIB_FOOTPRINT_MISMATCH */ class DRC_TEST_PROVIDER_LIBRARY_PARITY : public DRC_TEST_PROVIDER @@ -421,8 +422,11 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run() for( FOOTPRINT* footprint : board->Footprints() ) { - if( m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) ) + if( m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) + && m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_MISMATCH ) ) + { return true; // Continue with other tests + } if( !reportProgress( ii++, board->Footprints().size(), delta ) ) return false; // DRC cancelled @@ -440,7 +444,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run() { } - if( !libTableRow ) + if( !libTableRow && !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES ); msg.Printf( _( "The current configuration does not include the library '%s'." ), @@ -451,7 +455,8 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run() continue; } - else if( !libTable->HasLibrary( libName, true ) ) + else if( !libTable->HasLibrary( libName, true ) + && !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES )) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES ); msg.Printf( _( "The library '%s' is not enabled in the current configuration." ), @@ -484,7 +489,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run() } } - if( !libFootprint ) + if( !libFootprint && !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES ); msg.Printf( "Footprint '%s' not found in library '%s'.", @@ -494,9 +499,10 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run() drcItem->SetItems( footprint ); reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER ); } - else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) ) + else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) + && !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_MISMATCH )) { - std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES ); + std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_MISMATCH ); msg.Printf( "Footprint '%s' does not match copy in library '%s'.", fpName, libName ); diff --git a/qa/pcbnew/drc/test_drc_regressions.cpp b/qa/pcbnew/drc/test_drc_regressions.cpp index 3a65ba7a9f..17f0925576 100644 --- a/qa/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/pcbnew/drc/test_drc_regressions.cpp @@ -131,6 +131,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_MISMATCH ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) diff --git a/qa/pcbnew/test_tracks_cleaner.cpp b/qa/pcbnew/test_tracks_cleaner.cpp index 8cf1a9e3eb..2d44140bd0 100644 --- a/qa/pcbnew/test_tracks_cleaner.cpp +++ b/qa/pcbnew/test_tracks_cleaner.cpp @@ -173,6 +173,7 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE // Disable some DRC tests not useful in this testcase bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_MISMATCH ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE;