From 9a51a4c5b18aac06d5a5c97851914e36680b217a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 17 Jun 2015 14:48:37 -0700 Subject: [PATCH 1/3] fix debug build --- libraries/shared/src/MatrixStack.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/shared/src/MatrixStack.h b/libraries/shared/src/MatrixStack.h index 5a0b56ff9b..bcb4bb31a9 100644 --- a/libraries/shared/src/MatrixStack.h +++ b/libraries/shared/src/MatrixStack.h @@ -124,7 +124,9 @@ public: push(); f(); pop(); + #ifdef DEBUG assert(startingDepth = size()); + #endif } template From 44bb2201307b9e058669eb529fef4e7abc26509e Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 17 Jun 2015 14:54:13 -0700 Subject: [PATCH 2/3] fix debug build --- libraries/physics/src/MeshMassProperties.cpp | 2 ++ libraries/shared/src/MatrixStack.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/physics/src/MeshMassProperties.cpp b/libraries/physics/src/MeshMassProperties.cpp index 4e471f7870..21ad8a0e1c 100644 --- a/libraries/physics/src/MeshMassProperties.cpp +++ b/libraries/physics/src/MeshMassProperties.cpp @@ -283,9 +283,11 @@ void MeshMassProperties::computeMassProperties(const VectorOfPoints& points, con uint32_t numTriangles = triangleIndices.size() / 3; for (uint32_t i = 0; i < numTriangles; ++i) { uint32_t t = 3 * i; + #ifdef DEBUG assert(triangleIndices[t] < numPoints); assert(triangleIndices[t + 1] < numPoints); assert(triangleIndices[t + 2] < numPoints); + #endif // extract raw vertices tetraPoints[0] = p0; diff --git a/libraries/shared/src/MatrixStack.h b/libraries/shared/src/MatrixStack.h index bcb4bb31a9..0eea14a18a 100644 --- a/libraries/shared/src/MatrixStack.h +++ b/libraries/shared/src/MatrixStack.h @@ -125,7 +125,7 @@ public: f(); pop(); #ifdef DEBUG - assert(startingDepth = size()); + assert(startingDepth == size()); #endif } From 68df6b662de3c38a36b9483c7e3bd7f65f09aefc Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 17 Jun 2015 15:03:09 -0700 Subject: [PATCH 3/3] fix ifdefs around asserts --- libraries/physics/src/MeshMassProperties.cpp | 4 ++-- libraries/shared/src/MatrixStack.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/physics/src/MeshMassProperties.cpp b/libraries/physics/src/MeshMassProperties.cpp index 21ad8a0e1c..d18c068d26 100644 --- a/libraries/physics/src/MeshMassProperties.cpp +++ b/libraries/physics/src/MeshMassProperties.cpp @@ -270,7 +270,7 @@ void MeshMassProperties::computeMassProperties(const VectorOfPoints& points, con } // create some variables to hold temporary results - #ifdef DEBUG + #ifndef NDEBUG uint32_t numPoints = points.size(); #endif const btVector3 p0(0.0f, 0.0f, 0.0f); @@ -283,7 +283,7 @@ void MeshMassProperties::computeMassProperties(const VectorOfPoints& points, con uint32_t numTriangles = triangleIndices.size() / 3; for (uint32_t i = 0; i < numTriangles; ++i) { uint32_t t = 3 * i; - #ifdef DEBUG + #ifndef NDEBUG assert(triangleIndices[t] < numPoints); assert(triangleIndices[t + 1] < numPoints); assert(triangleIndices[t + 2] < numPoints); diff --git a/libraries/shared/src/MatrixStack.h b/libraries/shared/src/MatrixStack.h index 0eea14a18a..fdfea2b3cb 100644 --- a/libraries/shared/src/MatrixStack.h +++ b/libraries/shared/src/MatrixStack.h @@ -118,13 +118,13 @@ public: template void withPush(Function f) { - #ifdef DEBUG + #ifndef NDEBUG size_t startingDepth = size(); #endif push(); f(); pop(); - #ifdef DEBUG + #ifndef NDEBUG assert(startingDepth == size()); #endif }