From c17c9960d83141bd42153dad07dd1025b03c31cb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 9 Jan 2020 08:52:30 +0100 Subject: [PATCH] Eeschema: fix a colliding name between sch_text.h and a Windows/msys2 header. "INPUT" declaration in sch_text.h generate *a lot of* compil warnings. So it is replaced by PS_INPUT. For consistency, others member of enum class PINSHEETLABEL_SHAPE are also renamed. --- eeschema/connection_graph.cpp | 2 +- eeschema/edit_label.cpp | 2 +- eeschema/sch_legacy_plugin.cpp | 34 +++++++++++++++--------------- eeschema/sch_sheet_pin.cpp | 10 ++++----- eeschema/sch_text.cpp | 38 +++++++++++++++++----------------- eeschema/sch_text.h | 13 ++++++------ eeschema/sheet.cpp | 2 +- 7 files changed, 51 insertions(+), 50 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index dbfe9bcc2b..d3daaa5591 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -98,7 +98,7 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers ) { auto p = static_cast( c ); - if( p->GetShape() == PINSHEETLABEL_SHAPE::OUTPUT ) + if( p->GetShape() == PINSHEETLABEL_SHAPE::PSHAPE_OUTPUT ) { m_driver = c; break; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 5fb3f36fed..75285f2123 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -39,7 +39,7 @@ #include "invoke_sch_dialog.h" -static PINSHEETLABEL_SHAPE lastGlobalLabelShape = PINSHEETLABEL_SHAPE::INPUT; +static PINSHEETLABEL_SHAPE lastGlobalLabelShape = PINSHEETLABEL_SHAPE::PS_INPUT; static LABEL_SPIN_STYLE lastTextOrientation = LABEL_SPIN_STYLE::LEFT; static bool lastTextBold = false; static bool lastTextItalic = false; diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index a31361f5c5..a9ea9909a6 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -1033,23 +1033,23 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader ) switch( parseChar( aReader, line, &line ) ) { case 'I': - sheetPin->SetShape( PINSHEETLABEL_SHAPE::INPUT ); + sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_INPUT ); break; case 'O': - sheetPin->SetShape( PINSHEETLABEL_SHAPE::OUTPUT ); + sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_OUTPUT ); break; case 'B': - sheetPin->SetShape( PINSHEETLABEL_SHAPE::BIDI ); + sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_BIDI ); break; case 'T': - sheetPin->SetShape( PINSHEETLABEL_SHAPE::TRISTATE ); + sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_TRISTATE ); break; case 'U': - sheetPin->SetShape( PINSHEETLABEL_SHAPE::UNSPECIFIED ); + sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_UNSPECIFIED ); break; default: SCH_PARSE_ERROR( "invalid sheet pin type", aReader, line ); @@ -1364,11 +1364,11 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader ) // clang-format off const std::map sheetLabelNames { - { PINSHEETLABEL_SHAPE::INPUT, "Input" }, - { PINSHEETLABEL_SHAPE::OUTPUT, "Output" }, - { PINSHEETLABEL_SHAPE::BIDI, "BiDi" }, - { PINSHEETLABEL_SHAPE::TRISTATE, "3State" }, - { PINSHEETLABEL_SHAPE::UNSPECIFIED, "UnSpc" }, + { PINSHEETLABEL_SHAPE::PS_INPUT, "Input" }, + { PINSHEETLABEL_SHAPE::PS_OUTPUT, "Output" }, + { PINSHEETLABEL_SHAPE::PS_BIDI, "BiDi" }, + { PINSHEETLABEL_SHAPE::PS_TRISTATE, "3State" }, + { PINSHEETLABEL_SHAPE::PS_UNSPECIFIED, "UnSpc" }, }; // clang-format on @@ -1434,8 +1434,8 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader ) { auto resultIt = std::find_if( sheetLabelNames.begin(), sheetLabelNames.end(), [ &line ]( const auto& it ) - { - return strCompare( it.second, line, &line ); + { + return strCompare( it.second, line, &line ); } ); if( resultIt != sheetLabelNames.end() ) @@ -2187,20 +2187,20 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet ) switch( pin.GetShape() ) { - case PINSHEETLABEL_SHAPE::INPUT: + case PINSHEETLABEL_SHAPE::PS_INPUT: type = 'I'; break; - case PINSHEETLABEL_SHAPE::OUTPUT: + case PINSHEETLABEL_SHAPE::PS_OUTPUT: type = 'O'; break; - case PINSHEETLABEL_SHAPE::BIDI: + case PINSHEETLABEL_SHAPE::PS_BIDI: type = 'B'; break; - case PINSHEETLABEL_SHAPE::TRISTATE: + case PINSHEETLABEL_SHAPE::PS_TRISTATE: type = 'T'; break; default: - case PINSHEETLABEL_SHAPE::UNSPECIFIED: + case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: type = 'U'; break; } diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index 674c8275cc..8d695d391a 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -50,7 +50,7 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr else SetEdge( SHEET_LEFT_SIDE ); - m_shape = PINSHEETLABEL_SHAPE::INPUT; + m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; m_isDangling = true; m_number = 2; } @@ -252,11 +252,11 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector & aPoints, const wx switch( m_shape ) { - case PINSHEETLABEL_SHAPE::INPUT: - m_shape = PINSHEETLABEL_SHAPE::OUTPUT; + case PINSHEETLABEL_SHAPE::PS_INPUT: + m_shape = PINSHEETLABEL_SHAPE::PS_OUTPUT; break; - case PINSHEETLABEL_SHAPE::OUTPUT: - m_shape = PINSHEETLABEL_SHAPE::INPUT; + case PINSHEETLABEL_SHAPE::PS_OUTPUT: + m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; break; default: break; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index ea896fcc1f..ec95b17d4a 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -97,7 +97,7 @@ static int* TemplateShape[5][4] = SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) - : SCH_ITEM( NULL, aType ), EDA_TEXT( text ), m_shape( PINSHEETLABEL_SHAPE::INPUT ) + : SCH_ITEM( NULL, aType ), EDA_TEXT( text ), m_shape( PINSHEETLABEL_SHAPE::PS_INPUT ) { m_Layer = LAYER_NOTES; m_isDangling = false; @@ -587,19 +587,19 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { switch( GetShape() ) { - case PINSHEETLABEL_SHAPE::INPUT: + case PINSHEETLABEL_SHAPE::PS_INPUT: msg = _( "Input" ); break; - case PINSHEETLABEL_SHAPE::OUTPUT: + case PINSHEETLABEL_SHAPE::PS_OUTPUT: msg = _( "Output" ); break; - case PINSHEETLABEL_SHAPE::BIDI: + case PINSHEETLABEL_SHAPE::PS_BIDI: msg = _( "Bidirectional" ); break; - case PINSHEETLABEL_SHAPE::TRISTATE: + case PINSHEETLABEL_SHAPE::PS_TRISTATE: msg = _( "Tri-State" ); break; - case PINSHEETLABEL_SHAPE::UNSPECIFIED: + case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: msg = _( "Passive" ); break; default: @@ -647,7 +647,7 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : SCH_TEXT( pos, text, SCH_LABEL_T ) { m_Layer = LAYER_LOCLABEL; - m_shape = PINSHEETLABEL_SHAPE::INPUT; + m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; m_isDangling = true; SetMultilineAllowed( false ); } @@ -731,7 +731,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T ) { m_Layer = LAYER_GLOBLABEL; - m_shape = PINSHEETLABEL_SHAPE::BIDI; + m_shape = PINSHEETLABEL_SHAPE::PS_BIDI; m_isDangling = true; SetMultilineAllowed( false ); } @@ -754,14 +754,14 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const switch( m_shape ) { - case PINSHEETLABEL_SHAPE::INPUT: - case PINSHEETLABEL_SHAPE::BIDI: - case PINSHEETLABEL_SHAPE::TRISTATE: + case PINSHEETLABEL_SHAPE::PS_INPUT: + case PINSHEETLABEL_SHAPE::PS_BIDI: + case PINSHEETLABEL_SHAPE::PS_TRISTATE: offset += halfSize; break; - case PINSHEETLABEL_SHAPE::OUTPUT: - case PINSHEETLABEL_SHAPE::UNSPECIFIED: + case PINSHEETLABEL_SHAPE::PS_OUTPUT: + case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: offset += TXT_MARGIN; break; @@ -895,23 +895,23 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector & aPoints, const switch( m_shape ) { - case PINSHEETLABEL_SHAPE::INPUT: + case PINSHEETLABEL_SHAPE::PS_INPUT: x_offset = -halfSize; aPoints[0].x += halfSize; break; - case PINSHEETLABEL_SHAPE::OUTPUT: + case PINSHEETLABEL_SHAPE::PS_OUTPUT: aPoints[3].x -= halfSize; break; - case PINSHEETLABEL_SHAPE::BIDI: - case PINSHEETLABEL_SHAPE::TRISTATE: + case PINSHEETLABEL_SHAPE::PS_BIDI: + case PINSHEETLABEL_SHAPE::PS_TRISTATE: x_offset = -halfSize; aPoints[0].x += halfSize; aPoints[3].x -= halfSize; break; - case PINSHEETLABEL_SHAPE::UNSPECIFIED: + case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: default: break; } @@ -1019,7 +1019,7 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T : SCH_TEXT( pos, text, aType ) { m_Layer = LAYER_HIERLABEL; - m_shape = PINSHEETLABEL_SHAPE::INPUT; + m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; m_isDangling = true; SetMultilineAllowed( false ); } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 6205606d73..09f5b62fe9 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -40,7 +40,7 @@ class LINE_READER; class NETLIST_OBJECT_LIST; -/* +/* * Spin style for text items of all kinds on schematics * Basically a higher level abstraction of rotation and justification of text */ @@ -196,11 +196,12 @@ private: */ enum class PINSHEETLABEL_SHAPE { - INPUT, - OUTPUT, - BIDI, - TRISTATE, - UNSPECIFIED + PS_INPUT, // use "PS_INPUT" instead of "INPUT" to avoid colliding + // with a Windows header on msys2 + PS_OUTPUT, + PS_BIDI, + PS_TRISTATE, + PS_UNSPECIFIED }; diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 68540ac264..d6f7375c4f 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -766,7 +766,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, } -PINSHEETLABEL_SHAPE SCH_EDIT_FRAME::m_lastSheetPinType = PINSHEETLABEL_SHAPE::INPUT; +PINSHEETLABEL_SHAPE SCH_EDIT_FRAME::m_lastSheetPinType = PINSHEETLABEL_SHAPE::PS_INPUT; wxSize SCH_EDIT_FRAME::m_lastSheetPinTextSize( -1, -1 ); wxPoint SCH_EDIT_FRAME::m_lastSheetPinPosition;