ERC: fix "label not connected anywhere" ERC does not have configurable severity

Fix also the right message if the label is a global label.
Rename ERCE_GLOBLABEL to a better name ERCE_GLOBLABEL_DANGLING

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19119
This commit is contained in:
jean-pierre charras 2024-11-12 13:35:05 +01:00
parent 683ce4c904
commit 16d389a488
4 changed files with 15 additions and 12 deletions

View File

@ -3210,7 +3210,7 @@ int CONNECTION_GRAPH::RunERC()
}
if( settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED )
|| settings.IsTestEnabled( ERCE_GLOBLABEL ) )
|| settings.IsTestEnabled( ERCE_GLOBLABEL_DANGLING ) )
{
if( !ercCheckLabels( subgraph ) )
error_count++;
@ -3910,7 +3910,9 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
// connected to other valid things by way of another label on the same sheet.
if( text->IsDangling() )
{
reportError( text, ERCE_LABEL_NOT_CONNECTED );
reportError( text, item->Type() == SCH_GLOBAL_LABEL_T ?
ERCE_GLOBLABEL_DANGLING :
ERCE_LABEL_NOT_CONNECTED );
return false;
}
@ -3966,7 +3968,7 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
switch( type )
{
case SCH_GLOBAL_LABEL_T:
if( !settings.IsTestEnabled( ERCE_GLOBLABEL ) )
if( !settings.IsTestEnabled( ERCE_GLOBLABEL_DANGLING ) )
continue;
break;
@ -3999,14 +4001,14 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
if( allPins == 1 && !has_nc )
{
reportError( text, type == SCH_GLOBAL_LABEL_T ? ERCE_GLOBLABEL
reportError( text, type == SCH_GLOBAL_LABEL_T ? ERCE_GLOBLABEL_DANGLING
: ERCE_LABEL_NOT_CONNECTED );
ok = false;
}
if( allPins == 0 )
{
reportError( text, type == SCH_GLOBAL_LABEL_T ? ERCE_GLOBLABEL
reportError( text, type == SCH_GLOBAL_LABEL_T ? ERCE_GLOBLABEL_DANGLING
: ERCE_LABEL_NOT_CONNECTED );
ok = false;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -108,7 +108,7 @@ ERC_ITEM ERC_ITEM::labelDangling( ERCE_LABEL_NOT_CONNECTED,
_( "Label not connected to anything" ),
wxT( "label_dangling" ) );
ERC_ITEM ERC_ITEM::globalLabelDangling( ERCE_GLOBLABEL,
ERC_ITEM ERC_ITEM::globalLabelDangling( ERCE_GLOBLABEL_DANGLING,
_( "Global label not connected anywhere else in the schematic" ),
wxT( "global_label_dangling" ) );
@ -241,6 +241,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> ERC_ITEM::allItemTypes(
ERC_ITEM::noConnectConnected,
ERC_ITEM::noConnectDangling,
ERC_ITEM::globalLabelDangling,
ERC_ITEM::labelDangling,
ERC_ITEM::singleGlobalLabel,
ERC_ITEM::sameLocalGlobalLabel,
ERC_ITEM::wireDangling,
@ -327,7 +328,7 @@ std::shared_ptr<ERC_ITEM> ERC_ITEM::Create( int aErrorCode )
case ERCE_BUS_ENTRY_CONFLICT: return std::make_shared<ERC_ITEM>( netNotBusMember );
case ERCE_BUS_TO_BUS_CONFLICT: return std::make_shared<ERC_ITEM>( busToBusConflict );
case ERCE_BUS_TO_NET_CONFLICT: return std::make_shared<ERC_ITEM>( busToNetConflict );
case ERCE_GLOBLABEL: return std::make_shared<ERC_ITEM>( globalLabelDangling );
case ERCE_GLOBLABEL_DANGLING: return std::make_shared<ERC_ITEM>( globalLabelDangling );
case ERCE_UNRESOLVED_VARIABLE: return std::make_shared<ERC_ITEM>( unresolvedVariable );
case ERCE_UNDEFINED_NETCLASS: return std::make_shared<ERC_ITEM>( undefinedNetclass );
case ERCE_SIMULATION_MODEL: return std::make_shared<ERC_ITEM>( simulationModelIssues );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 CERN
* Copyright (C) 2024 CERN
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software: you can redistribute it and/or modify it
@ -101,7 +101,7 @@ ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
m_ERCSeverities[ERCE_SIMILAR_LABEL_AND_POWER] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_SINGLE_GLOBAL_LABEL] = RPT_SEVERITY_IGNORE;
m_ERCSeverities[ERCE_SAME_LOCAL_GLOBAL_LABEL] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_GLOBLABEL] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_GLOBLABEL_DANGLING] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_DRIVER_CONFLICT] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_BUS_ENTRY_CONFLICT] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_WARNING;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2020 CERN
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software; you can redistribute it and/or
@ -69,7 +69,7 @@ enum ERCE_T
///< one net.
ERCE_BUS_TO_NET_CONFLICT, ///< A bus wire is graphically connected to a net port/pin
///< (or vice versa).
ERCE_GLOBLABEL, ///< A global label is unique.
ERCE_GLOBLABEL_DANGLING, ///< A global label is dangling.
ERCE_UNRESOLVED_VARIABLE, ///< A text variable could not be resolved.
ERCE_UNDEFINED_NETCLASS, ///< A netclass was referenced but not defined.
ERCE_SIMULATION_MODEL, ///< An error was found in the simulation model.