Cleanup some build and Coverity warnings

This commit is contained in:
Ian McInerney 2020-07-31 02:46:05 +01:00
parent 294dabf640
commit 268dec5c19
8 changed files with 40 additions and 26 deletions

View File

@ -181,6 +181,7 @@ bool TOKENIZER::MatchAhead( const std::string& match, std::function<bool( int )>
COMPILER::COMPILER( REPORTER* aReporter, int aSourceLine, int aSourceOffset ) :
m_lexerState( COMPILER::LS_DEFAULT ),
m_reporter( aReporter ),
m_originLine( aSourceLine ),
m_originOffset( aSourceOffset )

View File

@ -49,7 +49,7 @@ private:
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
void OnSyntaxHelp( wxHyperlinkEvent& aEvent ) override;
void OnCompile( wxCommandEvent& event );
void OnCompile( wxCommandEvent& event ) override;
void OnErrorLinkClicked( wxHtmlLinkEvent& event ) override;
bool TransferDataToWindow() override;

View File

@ -44,7 +44,7 @@ public:
const wxPoint& getPoint4() const { return m_p; }
protected:
int m_a;
int m_a = 0;
wxPoint m_p;
};
@ -58,7 +58,7 @@ public:
int getC() const { return m_c; }
private:
int m_c;
int m_c = 0;
};
class C : public INSPECTABLE
@ -70,8 +70,8 @@ public:
int getNew() const { return m_m; }
void setNew( int m ) { m_m = m; }
int m_m;
bool m_bool;
int m_m = 0;
bool m_bool = false;
};
enum enum_glob { TEST1 = 0, TEST2 = 1, TEST3 = 4 };
@ -96,8 +96,8 @@ public:
enum_glob m_enum_glob;
enum_class m_enum_class;
int m_aa;
int m_cond;
int m_aa = 0;
int m_cond = 0;
};
class E : public D
@ -206,8 +206,9 @@ ENUM_TO_WXANY( D::enum_class );
struct PropertiesFixture
{
PropertiesFixture()
: propMgr( PROPERTY_MANAGER::Instance() )
PropertiesFixture() :
ptr( nullptr ),
propMgr( PROPERTY_MANAGER::Instance() )
{
}

View File

@ -31,7 +31,11 @@
#include <pcb_expr_evaluator.h>
test::DRC_RULE::DRC_RULE()
test::DRC_RULE::DRC_RULE() :
m_Unary( false ),
m_Enabled( false ),
m_Conditional( false ),
m_Priority( 0 )
{
}
@ -72,7 +76,7 @@ bool test::DRC_RULE_CONDITION::Compile( REPORTER* aReporter, int aSourceLine, in
m_ucode = new PCB_EXPR_UCODE;
LIBEVAL::CONTEXT preflightContext;
bool ok = compiler.Compile( m_Expression.ToUTF8().data(), m_ucode, &preflightContext );
return ok;
}

View File

@ -2,7 +2,9 @@
#include <drc_proto/drc_item.h>
#include <drc_proto/drc_test_provider.h>
test::DRC_TEST_PROVIDER::DRC_TEST_PROVIDER ()
test::DRC_TEST_PROVIDER::DRC_TEST_PROVIDER() :
m_drcEngine( nullptr ),
m_enable( false )
{
}

View File

@ -37,12 +37,15 @@ class DRC_TEST_PROVIDER_CLEARANCE_BASE : public DRC_TEST_PROVIDER
{
public:
DRC_TEST_PROVIDER_CLEARANCE_BASE () :
DRC_TEST_PROVIDER()
DRC_TEST_PROVIDER(),
m_board( nullptr ),
m_largestClearance( 0 ),
m_boardOutlineValid( false )
{
}
virtual ~DRC_TEST_PROVIDER_CLEARANCE_BASE()
virtual ~DRC_TEST_PROVIDER_CLEARANCE_BASE()
{
}

View File

@ -53,19 +53,21 @@ class DRC_TEST_PROVIDER_HOLE_CLEARANCE : public DRC_TEST_PROVIDER_CLEARANCE_BASE
{
public:
DRC_TEST_PROVIDER_HOLE_CLEARANCE () :
DRC_TEST_PROVIDER_CLEARANCE_BASE()
DRC_TEST_PROVIDER_CLEARANCE_BASE(),
m_board( nullptr ),
m_largestRadius( 0 )
{
}
virtual ~DRC_TEST_PROVIDER_HOLE_CLEARANCE()
virtual ~DRC_TEST_PROVIDER_HOLE_CLEARANCE()
{
}
virtual bool Run() override;
virtual const wxString GetName() const override
virtual const wxString GetName() const override
{
return "hole_clearance";
return "hole_clearance";
};
virtual const wxString GetDescription() const override
@ -148,7 +150,7 @@ void test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::buildHoleList()
if( holeSize == 0 )
continue;
// fixme: support for non-round (i.e. slotted) holes
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
addHole( pad->GetPosition(), pad->GetDrillSize().x / 2, pad );
@ -221,7 +223,7 @@ bool test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc( D_PAD* aRefPad,
if( pad == aRefPad )
continue;
// drc_dbg(10," chk against -> %p\n", pad);
@ -231,7 +233,7 @@ bool test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc( D_PAD* aRefPad,
break;
// drc_dbg(10," chk2 against -> %p ds %d %d\n", pad, pad->GetDrillSize().x, aRefPad->GetDrillSize().x );
drc_dbg(1," chk1 against -> %p x0 %d x2 %d\n", pad, pad->GetDrillSize().x, aRefPad->GetDrillSize().x );
// No problem if pads which are on copper layers are on different copper layers,
@ -304,7 +306,7 @@ bool test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc( D_PAD* aRefPad,
int actual;
accountCheck( rule );
drc_dbg(1,"check pad %p rule '%s' cl %d\n", aRefPad, (const char*) rule->GetName().c_str(), minClearance );
auto padShape = pad->GetEffectiveShape();
@ -386,7 +388,7 @@ void test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::testHoles2Holes()
DRC_RULE* rule = m_drcEngine->EvalRulesForItems( test::DRC_RULE_ID_T::DRC_RULE_ID_HOLE_CLEARANCE, refHole.m_owner, checkHole.m_owner );
int minClearance = rule->GetConstraint().GetValue().Min();
accountCheck( rule );
if( actual < minClearance )
@ -421,4 +423,4 @@ std::set<test::DRC_RULE_ID_T> test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::GetMatchin
namespace detail
{
static test::DRC_REGISTER_TEST_PROVIDER<test::DRC_TEST_PROVIDER_HOLE_CLEARANCE> dummy;
}
}

View File

@ -55,7 +55,8 @@ namespace test
class DRC_TEST_PROVIDER_HOLE_SIZE : public DRC_TEST_PROVIDER
{
public:
DRC_TEST_PROVIDER_HOLE_SIZE()
DRC_TEST_PROVIDER_HOLE_SIZE() :
m_board( nullptr )
{
}
@ -200,4 +201,4 @@ std::set<test::DRC_RULE_ID_T> test::DRC_TEST_PROVIDER_HOLE_SIZE::GetMatchingRule
namespace detail
{
static test::DRC_REGISTER_TEST_PROVIDER<test::DRC_TEST_PROVIDER_HOLE_SIZE> dummy;
}
}