Fix build warnings

So. many. build warnings. :)  Ran multiple times with clang and gcc to
try to get them all
This commit is contained in:
Seth Hillbrand
2026-03-02 13:28:48 -08:00
parent aa9b1d9dd6
commit 37cbfbdaaa
18 changed files with 51 additions and 47 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_IMPORT::FORMAT,
{
{ JOB_PCB_IMPORT::FORMAT::AUTO, "auto" },
{ JOB_PCB_IMPORT::FORMAT::PADS, "pads" },
{ JOB_PCB_IMPORT::FORMAT::PADS_ASCII, "pads" },
{ JOB_PCB_IMPORT::FORMAT::ALTIUM, "altium" },
{ JOB_PCB_IMPORT::FORMAT::EAGLE, "eagle" },
{ JOB_PCB_IMPORT::FORMAT::CADSTAR, "cadstar" },
+1 -1
View File
@@ -40,7 +40,7 @@ public:
enum class FORMAT
{
AUTO,
PADS,
PADS_ASCII,
ALTIUM,
EAGLE,
CADSTAR,
+1 -1
View File
@@ -167,7 +167,7 @@ void LIB_SYMBOL::GetChooserFields( std::map<wxString, wxString>& aColumnMap )
// If the user has a field named "Keywords", then prefer that. Otherwise add the KiCad
// keywords.
const wxString& localizedKeywords = _( "Keywords" );
const wxString localizedKeywords = _( "Keywords" );
if( !aColumnMap.contains( localizedKeywords ) )
aColumnMap[localizedKeywords] = GetShownKeyWords();
+1 -1
View File
@@ -83,7 +83,7 @@ int CLI::PCB_IMPORT_COMMAND::doPerform( KIWAY& aKiway )
}
else if( format == wxS( "pads" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::PADS;
importJob->m_format = JOB_PCB_IMPORT::FORMAT::PADS_ASCII;
}
else if( format == wxS( "altium" ) )
{
+6 -10
View File
@@ -103,14 +103,14 @@ bool PIN::IsIsomorphic( const PIN& b, TOPOLOGY_MISMATCH_REASON& aReason ) const
std::vector<bool> matches( m_conns.size() );
for( int i = 0; i < m_conns.size(); i++ )
for( size_t i = 0; i < m_conns.size(); i++ )
matches[i] = false;
int nref = 0;
size_t nref = 0;
for( auto& cref : m_conns )
{
for( int i = 0; i < m_conns.size(); i++ )
for( size_t i = 0; i < m_conns.size(); i++ )
{
if( b.m_conns[i]->IsTopologicallySimilar( *cref ) )
{
@@ -122,7 +122,7 @@ bool PIN::IsIsomorphic( const PIN& b, TOPOLOGY_MISMATCH_REASON& aReason ) const
nref++;
}
for( int i = 0; i < m_conns.size(); i++ )
for( size_t i = 0; i < m_conns.size(); i++ )
{
if( !matches[i] )
{
@@ -276,7 +276,6 @@ CONNECTION_GRAPH::findMatchingComponents( COMPONENT*
aMismatchReasons.clear();
std::vector<COMPONENT*> matches;
int candidatesChecked = 0;
int skippedLocked = 0;
// Build the net consistency map from locked pairs once for this entire evaluation
// pass, rather than rebuilding it from scratch for every candidate.
@@ -287,10 +286,7 @@ CONNECTION_GRAPH::findMatchingComponents( COMPONENT*
for( COMPONENT* cmpTarget : aStructuralMatches )
{
if( partialMatches.m_locked.find( cmpTarget ) != partialMatches.m_locked.end() )
{
skippedLocked++;
continue;
}
candidatesChecked++;
@@ -672,7 +668,6 @@ bool CONNECTION_GRAPH::FindIsomorphism( CONNECTION_GRAPH* aTarget, COMPONENT_MAT
stack.push_back( top );
bool matchFound = false;
int nloops = 0;
while( !stack.empty() )
@@ -748,7 +743,8 @@ bool CONNECTION_GRAPH::FindIsomorphism( CONNECTION_GRAPH* aTarget, COMPONENT_MAT
continue;
}
if( current.m_currentMatch >= 0 && current.m_currentMatch >= current.m_matches.size() )
if( current.m_currentMatch >= 0
&& static_cast<size_t>( current.m_currentMatch ) >= current.m_matches.size() )
{
wxLogTrace( traceTopoMatch, wxT( "stk: No more matches, going up [level=%d]\n" ),
(int) stack.size() );
@@ -102,14 +102,14 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_upperSizer->Layout();
// initialize controls based on update mode in case there is no saved state yet
m_removeExtraBox->SetValue( m_updateMode ? false : false );
m_removeExtraBox->SetValue( false );
m_resetTextItemLayers->SetValue( m_updateMode ? false : true );
m_resetTextItemEffects->SetValue( m_updateMode ? false : true );
m_resetTextItemPositions->SetValue( m_updateMode ? false : true );
m_resetTextItemContent->SetValue( m_updateMode ? false : true );
m_resetFabricationAttrs->SetValue( m_updateMode ? false : true );
m_resetClearanceOverrides->SetValue( m_updateMode ? true : true );
m_reset3DModels->SetValue( m_updateMode ? true : true );
m_resetClearanceOverrides->SetValue( true );
m_reset3DModels->SetValue( true );
// initialize match-mode
if( m_updateMode )
+4 -4
View File
@@ -264,10 +264,10 @@ public:
///! The properties of a padstack drill. Drill position is always the pad position (origin).
struct DRILL_PROPS
{
VECTOR2I size; ///< Drill diameter (x == y) or slot dimensions (x != y)
PAD_DRILL_SHAPE shape;
PCB_LAYER_ID start;
PCB_LAYER_ID end;
VECTOR2I size; ///< Drill diameter (x == y) or slot dimensions (x != y)
PAD_DRILL_SHAPE shape = PAD_DRILL_SHAPE::UNDEFINED;
PCB_LAYER_ID start = UNDEFINED_LAYER;
PCB_LAYER_ID end = UNDEFINED_LAYER;
std::optional<bool> is_filled; ///< True if the drill hole should be filled completely
std::optional<bool> is_capped; ///< True if the drill hole should be capped
@@ -51,6 +51,8 @@ struct RESOLVABLE
{
}
virtual ~RESOLVABLE() = default;
virtual bool Resolve( const DB_OBJ_RESOLVER& aResolver ) = 0;
virtual std::string DebugString() const;
-1
View File
@@ -1922,7 +1922,6 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
}
VECTOR2I referencePoint0 = aElem.referencePoint.at( 0 );
VECTOR2I referencePoint1 = aElem.referencePoint.at( 1 );
std::unique_ptr<PCB_DIM_RADIAL> dimension = std::make_unique<PCB_DIM_RADIAL>( m_board );
@@ -236,8 +236,8 @@ BOARD* PCB_IO_EASYEDAPRO::LoadBoard( const wxString& aFileName, BOARD* aAppendTo
pcbLines = &lineBlocks[0];
wxString boardKey = pcbUuid + wxS( "_0" );
wxScopedCharBuffer cb = boardKey.ToUTF8();
wxString boardPouredKey = wxBase64Encode( cb.data(), cb.length() );
wxScopedCharBuffer boardKeyBuffer = boardKey.ToUTF8();
wxString boardPouredKey = wxBase64Encode( boardKeyBuffer.data(), boardKeyBuffer.length() );
const std::multimap<wxString, EASYEDAPRO::POURED>& boardPoured =
get_def( m_projectData->m_Poured, boardPouredKey );
+15 -15
View File
@@ -800,19 +800,19 @@ void PCB_IO_IPC2581::addText( wxXmlNode* aContentNode, EDA_TEXT* aText,
wxXmlNode* poly_node = appendNode( outline_node, "Polygon" );
addLineDesc( outline_node, 0, LINE_STYLE::SOLID );
const std::vector<VECTOR2I>& pts = aPoly.CPoints();
const std::vector<VECTOR2I>& polyPts = aPoly.CPoints();
wxXmlNode* point_node = appendNode( poly_node, "PolyBegin" );
addXY( point_node, pts.front() );
addXY( point_node, polyPts.front() );
for( size_t ii = 1; ii < pts.size(); ++ii )
for( size_t ii = 1; ii < polyPts.size(); ++ii )
{
wxXmlNode* poly_step_node =
appendNode( poly_node, "PolyStepSegment" );
addXY( poly_step_node, pts[ii] );
addXY( poly_step_node, polyPts[ii] );
}
point_node = appendNode( poly_node, "PolyStepSegment" );
addXY( point_node, pts.front() );
addXY( point_node, polyPts.front() );
} );
//TODO: handle multiline text
@@ -2394,19 +2394,19 @@ void PCB_IO_IPC2581::addPadStack( wxXmlNode* aContentNode, const PCB_VIA* aVia )
LSEQ layer_seq = aVia->GetLayerSet().Seq();
auto addPadShape{ [&]( PCB_LAYER_ID layer, const PCB_VIA* aVia, const wxString& name,
bool drill ) -> void
auto addPadShape{ [&]( PCB_LAYER_ID aLayer, const PCB_VIA* aViaShape, const wxString& aLayerRef,
bool aDrill ) -> void
{
PCB_SHAPE shape( nullptr, SHAPE_T::CIRCLE );
if( drill )
shape.SetEnd( { KiROUND( aVia->GetDrillValue() / 2.0 ), 0 } );
if( aDrill )
shape.SetEnd( { KiROUND( aViaShape->GetDrillValue() / 2.0 ), 0 } );
else
shape.SetEnd( { KiROUND( aVia->GetWidth( layer ) / 2.0 ), 0 } );
shape.SetEnd( { KiROUND( aViaShape->GetWidth( aLayer ) / 2.0 ), 0 } );
wxXmlNode* padStackPadDefNode =
appendNode( padStackDefNode, "PadstackPadDef" );
addAttribute( padStackPadDefNode, "layerRef", name );
addAttribute( padStackPadDefNode, "layerRef", aLayerRef );
addAttribute( padStackPadDefNode, "padUse", "REGULAR" );
addLocationNode( padStackPadDefNode, 0.0, 0.0 );
@@ -2901,16 +2901,16 @@ wxXmlNode* PCB_IO_IPC2581::addPackage( wxXmlNode* aContentNode, FOOTPRINT* aFp )
parent = otherSideViewNode;
}
wxString name;
wxString nodeName;
if( aLayer == F_SilkS || aLayer == B_SilkS )
name = "SilkScreen";
nodeName = "SilkScreen";
else if( aLayer == F_Fab || aLayer == B_Fab )
name = "AssemblyDrawing";
nodeName = "AssemblyDrawing";
else
wxASSERT( false );
wxXmlNode* new_node = appendNode( parent, name );
wxXmlNode* new_node = appendNode( parent, nodeName );
return new_node;
};
@@ -7636,8 +7636,8 @@ PCB_IO_KICAD_SEXPR_PARSER::parseFrontBackOptBool( bool aAllowLegacyFormat )
{
T token = NextTok();
std::optional<bool> front( std::nullopt );
std::optional<bool> back( std::nullopt );
std::optional<bool> front{};
std::optional<bool> back{};
if( token != T_LEFT && aAllowLegacyFormat )
{
@@ -7665,7 +7665,16 @@ PCB_IO_KICAD_SEXPR_PARSER::parseFrontBackOptBool( bool aAllowLegacyFormat )
token = NextTok();
}
// GCC false-positive: both front and back are initialized to {} above and can only be
// set or reset inside this loop, never left in an indeterminate state.
#if defined( __GNUC__ ) && !defined( __clang__ )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
return { front, back };
#if defined( __GNUC__ ) && !defined( __clang__ )
#pragma GCC diagnostic pop
#endif
}
while( token != T_RIGHT )
+1 -1
View File
@@ -671,7 +671,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
{
if( token == "sheetfile" )
{
for( const wxString& extension : { wxT( ".sch" ), wxT( ".kicad_sch" ) } )
for( const wxString extension : { wxT( ".sch" ), wxT( ".kicad_sch" ) } )
{
if( value == aSrcProjectName + extension )
{
+1 -1
View File
@@ -2831,7 +2831,7 @@ int PCBNEW_JOBS_HANDLER::JobImport( JOB* aJob )
fileType = PCB_IO_MGR::FindPluginTypeFromBoardPath( job->m_inputFile );
break;
case JOB_PCB_IMPORT::FORMAT::PADS:
case JOB_PCB_IMPORT::FORMAT::PADS_ASCII:
fileType = PCB_IO_MGR::PADS;
break;
+1 -1
View File
@@ -1760,7 +1760,7 @@ bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_
if( !layers[ layer ] )
continue;
for( int polyId = 0; polyId < poly->TriangulatedPolyCount(); polyId++ )
for( unsigned int polyId = 0; polyId < poly->TriangulatedPolyCount(); polyId++ )
{
const SHAPE_POLY_SET::TRIANGULATED_POLYGON* tri = poly->TriangulatedPolygon( polyId );
+1 -1
View File
@@ -356,7 +356,7 @@ bool SHOVE::shoveLineToHullSet( const LINE& aCurLine, const LINE& aObstacleLine,
return nearestP;
};
int minDist0, minDist1, minhull0, minhull1;
int minDist0 = -1, minDist1 = -1, minhull0 = -1, minhull1 = -1;
VECTOR2I p0 = minDistP( l_base.CPoint( 0 ), minDist0, minhull0 );
VECTOR2I p1 = minDistP( l_base.CLastPoint(), minDist1, minhull1 );
@@ -106,7 +106,6 @@ ZONE_PREVIEW_CANVAS::ZONE_PREVIEW_CANVAS( BOARD* aPcb, ZONE* aZone, PCB_LAYER_ID
const wxPoint& aPosition, const wxSize& aSize, GAL_TYPE aGalType ) :
PCB_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, wxDefaultSize, aOptions, aGalType ),
m_pcb( aPcb ),
m_layer( aLayer ),
m_pcb_bounding_box( std::make_unique<BOARD_EDGES_BOUNDING_ITEM>( aPcb->GetBoardEdgesBoundingBox() ) ),
m_zoomLocked( false )
{
@@ -56,7 +56,6 @@ public:
private:
BOARD* m_pcb;
int m_layer;
std::unique_ptr<BOARD_EDGES_BOUNDING_ITEM> m_pcb_bounding_box;
bool m_zoomLocked;
};