kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #20009
[PATCH] Eeschema ERC now catches errors of unmatched global labels
This is a resubmitting of a patch file (attached) that fixes the issue
of [Bug 1487945]. This time it it more coding style compliant as
suggested in other developer's comments.
The fix passed tests on Ubuntu 15.04, based off KiCAD BZR 6133
--Joe
------ Here is the copy & paste of the patch file -------------------
diff --git a/eeschema/class_drc_erc_item.cpp
b/eeschema/class_drc_erc_item.cpp
index 8e35bfe..74f6ea3 100644
--- a/eeschema/class_drc_erc_item.cpp
+++ b/eeschema/class_drc_erc_item.cpp
@@ -52,6 +52,8 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Mismatch between hierarchical labels and
pins sheets"));
case ERCE_NOCONNECT_CONNECTED:
return wxString( _("A no connect symbol is connected to more
than 1 pin"));
+ case ERCE_GLOBLABEL:
+ return wxString( _("A global label not connected to any other
global label") );
default:
return wxString( wxT("Unkown.") );
diff --git a/eeschema/class_netlist_object.cpp
b/eeschema/class_netlist_object.cpp
index 169a28f..7954206 100644
--- a/eeschema/class_netlist_object.cpp
+++ b/eeschema/class_netlist_object.cpp
@@ -228,6 +228,11 @@ bool NETLIST_OBJECT::IsLabelConnected(
NETLIST_OBJECT* aNetItem )
return true; //connected!
}
}
+ else if( ( at == NET_GLOBLABEL ) && ( bt == NET_GLOBLABEL ) )
+ {
+ if( m_Label == aNetItem->m_Label )
+ return true; //connected!
+ }
return false; //these two are unconnected
}
diff --git a/eeschema/dialogs/dialog_erc.cpp
b/eeschema/dialogs/dialog_erc.cpp
index 4dca4d5..c14aa70 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -499,7 +499,6 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
- case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
break;
@@ -507,6 +506,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER:
+ case NET_GLOBLABEL:
// ERC problems when pin sheets do not match hierarchical
labels.
// Each pin sheet must match a hierarchical label
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index e477610..099249c 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -251,18 +251,30 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef,
NETLIST_OBJECT* aNetItemTst,
{
msg.Printf( _( "Hierarchical label %s is not connected to
a sheet label." ),
GetChars( aNetItemRef->m_Label ) );
+ marker->SetData( ERCE_HIERACHICAL_LABEL,
+ aNetItemRef->m_Start,
+ msg,
+ aNetItemRef->m_Start );
+ }
+ else if( (aNetItemRef->m_Type == NET_GLOBLABEL) )
+ {
+ msg.Printf( _( "Global label %s is not connected to any
other global label." ),
+ GetChars( aNetItemRef->m_Label ) );
+ marker->SetData( ERCE_GLOBLABEL,
+ aNetItemRef->m_Start,
+ msg,
+ aNetItemRef->m_Start );
}
else
{
msg.Printf( _( "Sheet label %s is not connected to a
hierarchical label." ),
GetChars( aNetItemRef->m_Label ) );
+ marker->SetData( ERCE_HIERACHICAL_LABEL,
+ aNetItemRef->m_Start,
+ msg,
+ aNetItemRef->m_Start );
}
-
- marker->SetData( ERCE_HIERACHICAL_LABEL,
- aNetItemRef->m_Start,
- msg,
- aNetItemRef->m_Start );
return;
}
diff --git a/eeschema/erc.h b/eeschema/erc.h
index 1e01515..908c498 100644
--- a/eeschema/erc.h
+++ b/eeschema/erc.h
@@ -57,6 +57,7 @@ extern const wxString CommentERC_V[];
#define ERCE_PIN_TO_PIN_ERROR 5 // pin connected to an other
pin: error level
#define ERCE_HIERACHICAL_LABEL 6 // mismatch between
hierarchical labels and pins sheets
#define ERCE_NOCONNECT_CONNECTED 7 // a no connect symbol is
connected to more than 1 pin
+#define ERCE_GLOBLABEL 8 // a global label not connected
to any other global label
/* Minimal connection table */
#define NPI 4 // Net with Pin isolated, this pin has type Not
Connected and must be left N.C.
diff --git a/eeschema/class_drc_erc_item.cpp b/eeschema/class_drc_erc_item.cpp
index 8e35bfe..74f6ea3 100644
--- a/eeschema/class_drc_erc_item.cpp
+++ b/eeschema/class_drc_erc_item.cpp
@@ -52,6 +52,8 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Mismatch between hierarchical labels and pins sheets"));
case ERCE_NOCONNECT_CONNECTED:
return wxString( _("A no connect symbol is connected to more than 1 pin"));
+ case ERCE_GLOBLABEL:
+ return wxString( _("A global label not connected to any other global label") );
default:
return wxString( wxT("Unkown.") );
diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp
index 169a28f..7954206 100644
--- a/eeschema/class_netlist_object.cpp
+++ b/eeschema/class_netlist_object.cpp
@@ -228,6 +228,11 @@ bool NETLIST_OBJECT::IsLabelConnected( NETLIST_OBJECT* aNetItem )
return true; //connected!
}
}
+ else if( ( at == NET_GLOBLABEL ) && ( bt == NET_GLOBLABEL ) )
+ {
+ if( m_Label == aNetItem->m_Label )
+ return true; //connected!
+ }
return false; //these two are unconnected
}
diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 4dca4d5..c14aa70 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -499,7 +499,6 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
- case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
break;
@@ -507,6 +506,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER:
+ case NET_GLOBLABEL:
// ERC problems when pin sheets do not match hierarchical labels.
// Each pin sheet must match a hierarchical label
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index e477610..099249c 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -251,18 +251,30 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
{
msg.Printf( _( "Hierarchical label %s is not connected to a sheet label." ),
GetChars( aNetItemRef->m_Label ) );
+ marker->SetData( ERCE_HIERACHICAL_LABEL,
+ aNetItemRef->m_Start,
+ msg,
+ aNetItemRef->m_Start );
+ }
+ else if( (aNetItemRef->m_Type == NET_GLOBLABEL) )
+ {
+ msg.Printf( _( "Global label %s is not connected to any other global label." ),
+ GetChars( aNetItemRef->m_Label ) );
+ marker->SetData( ERCE_GLOBLABEL,
+ aNetItemRef->m_Start,
+ msg,
+ aNetItemRef->m_Start );
}
else
{
msg.Printf( _( "Sheet label %s is not connected to a hierarchical label." ),
GetChars( aNetItemRef->m_Label ) );
+ marker->SetData( ERCE_HIERACHICAL_LABEL,
+ aNetItemRef->m_Start,
+ msg,
+ aNetItemRef->m_Start );
}
-
- marker->SetData( ERCE_HIERACHICAL_LABEL,
- aNetItemRef->m_Start,
- msg,
- aNetItemRef->m_Start );
return;
}
diff --git a/eeschema/erc.h b/eeschema/erc.h
index 1e01515..908c498 100644
--- a/eeschema/erc.h
+++ b/eeschema/erc.h
@@ -57,6 +57,7 @@ extern const wxString CommentERC_V[];
#define ERCE_PIN_TO_PIN_ERROR 5 // pin connected to an other pin: error level
#define ERCE_HIERACHICAL_LABEL 6 // mismatch between hierarchical labels and pins sheets
#define ERCE_NOCONNECT_CONNECTED 7 // a no connect symbol is connected to more than 1 pin
+#define ERCE_GLOBLABEL 8 // a global label not connected to any other global label
/* Minimal connection table */
#define NPI 4 // Net with Pin isolated, this pin has type Not Connected and must be left N.C.
Follow ups