Improved macro protection.
This commit is contained in:
parent
222cd4d009
commit
967ee2c85b
|
@ -75,6 +75,7 @@ public:
|
||||||
// In "DRC" mode (aReporter == nulltpr) properties are only checked until a difference is found.
|
// In "DRC" mode (aReporter == nulltpr) properties are only checked until a difference is found.
|
||||||
//
|
//
|
||||||
#define TEST( a, b, msg ) \
|
#define TEST( a, b, msg ) \
|
||||||
|
{ \
|
||||||
if( a != b ) \
|
if( a != b ) \
|
||||||
{ \
|
{ \
|
||||||
diff = true; \
|
diff = true; \
|
||||||
|
@ -85,11 +86,11 @@ public:
|
||||||
\
|
\
|
||||||
if( diff && !aReporter ) \
|
if( diff && !aReporter ) \
|
||||||
return diff; \
|
return diff; \
|
||||||
/* Prevent binding to else following macro */ \
|
}
|
||||||
else {}
|
|
||||||
|
|
||||||
#define EPSILON 0.000001
|
#define EPSILON 0.000001
|
||||||
#define TEST_D( a, b, msg ) \
|
#define TEST_D( a, b, msg ) \
|
||||||
|
{ \
|
||||||
if( abs( a - b ) > EPSILON ) \
|
if( abs( a - b ) > EPSILON ) \
|
||||||
{ \
|
{ \
|
||||||
diff = true; \
|
diff = true; \
|
||||||
|
@ -100,10 +101,10 @@ public:
|
||||||
\
|
\
|
||||||
if( diff && !aReporter ) \
|
if( diff && !aReporter ) \
|
||||||
return diff; \
|
return diff; \
|
||||||
/* Prevent binding to else following macro */ \
|
}
|
||||||
else {}
|
|
||||||
|
|
||||||
#define TEST_V3D( a, b, msg ) \
|
#define TEST_V3D( a, b, msg ) \
|
||||||
|
{ \
|
||||||
if( abs( a.x - b.x ) > EPSILON \
|
if( abs( a.x - b.x ) > EPSILON \
|
||||||
|| abs( a.y - b.y ) > EPSILON \
|
|| abs( a.y - b.y ) > EPSILON \
|
||||||
|| abs( a.z - b.z ) > EPSILON ) \
|
|| abs( a.z - b.z ) > EPSILON ) \
|
||||||
|
@ -116,8 +117,7 @@ public:
|
||||||
\
|
\
|
||||||
if( diff && !aReporter ) \
|
if( diff && !aReporter ) \
|
||||||
return diff; \
|
return diff; \
|
||||||
/* Prevent binding to else following macro */ \
|
}
|
||||||
else {}
|
|
||||||
|
|
||||||
bool primitiveNeedsUpdate( const std::shared_ptr<PCB_SHAPE>& a,
|
bool primitiveNeedsUpdate( const std::shared_ptr<PCB_SHAPE>& a,
|
||||||
const std::shared_ptr<PCB_SHAPE>& b )
|
const std::shared_ptr<PCB_SHAPE>& b )
|
||||||
|
@ -154,9 +154,7 @@ bool primitiveNeedsUpdate( const std::shared_ptr<PCB_SHAPE>& a,
|
||||||
TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices(), wxEmptyString);
|
TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices(), wxEmptyString);
|
||||||
|
|
||||||
for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
|
for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
|
||||||
{
|
|
||||||
TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ), wxEmptyString );
|
TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ), wxEmptyString );
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -189,9 +187,7 @@ bool padNeedsUpdate( const PAD* a, const PAD* b )
|
||||||
|
|
||||||
// NB: KeepTopBottom is undefined if RemoveUnconnected is NOT set.
|
// NB: KeepTopBottom is undefined if RemoveUnconnected is NOT set.
|
||||||
if( a->GetRemoveUnconnected() )
|
if( a->GetRemoveUnconnected() )
|
||||||
{
|
|
||||||
TEST( a->GetKeepTopBottom(), b->GetKeepTopBottom(), wxEmptyString );
|
TEST( a->GetKeepTopBottom(), b->GetKeepTopBottom(), wxEmptyString );
|
||||||
}
|
|
||||||
|
|
||||||
TEST( a->GetShape(), b->GetShape(), wxEmptyString );
|
TEST( a->GetShape(), b->GetShape(), wxEmptyString );
|
||||||
|
|
||||||
|
@ -303,9 +299,7 @@ bool shapeNeedsUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
|
||||||
TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices(), wxEmptyString );
|
TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices(), wxEmptyString );
|
||||||
|
|
||||||
for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
|
for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
|
||||||
{
|
|
||||||
TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ), wxEmptyString );
|
TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ), wxEmptyString );
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -401,9 +395,7 @@ bool zonesNeedUpdate( const FP_ZONE* a, const FP_ZONE* b )
|
||||||
bPoly.Move( parentFootprint->GetPosition() );
|
bPoly.Move( parentFootprint->GetPosition() );
|
||||||
|
|
||||||
for( int ii = 0; ii < a->Outline()->TotalVertices(); ++ii )
|
for( int ii = 0; ii < a->Outline()->TotalVertices(); ++ii )
|
||||||
{
|
|
||||||
TEST( aPoly.CVertex( ii ), bPoly.CVertex( ii ) , wxEmptyString);
|
TEST( aPoly.CVertex( ii ), bPoly.CVertex( ii ) , wxEmptyString);
|
||||||
}
|
|
||||||
|
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue