Improving homogeneity of DEBUG macro for improved portability with compilers other than Visual Studio
parent
29c125e51d
commit
4e7b59be55
|
@ -74,7 +74,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Helper macro to set a pointer to NULL in debug builds
|
||||
*/
|
||||
#if (defined _DEBUG)
|
||||
#if (defined ASSIMP_BUILD_DEBUG)
|
||||
# define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
|
||||
#else
|
||||
# define AI_DEBUG_INVALIDATE_PTR(x)
|
||||
|
|
|
@ -533,7 +533,7 @@ void BatchLoader::LoadAll()
|
|||
for (std::list<LoadRequest>::iterator it = data->requests.begin();it != data->requests.end(); ++it) {
|
||||
// force validation in debug builds
|
||||
unsigned int pp = (*it).flags;
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
pp |= aiProcess_ValidateDataStructure;
|
||||
#endif
|
||||
// setup config properties if necessary
|
||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "TinyFormatter.h"
|
||||
|
||||
// enable verbose log output. really verbose, so be careful.
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
# define ASSIMP_BUILD_BLENDER_DEBUG
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1838,7 +1838,7 @@ private:
|
|||
ai_assert(curves.size());
|
||||
|
||||
// sanity check whether the input is ok
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
{ const Object* target = NULL;
|
||||
BOOST_FOREACH(const AnimationCurveNode* node, curves) {
|
||||
if(!target) {
|
||||
|
|
|
@ -565,7 +565,7 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha
|
|||
// terminate zlib
|
||||
inflateEnd(&zstream);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
else {
|
||||
// runtime check for this happens at tokenization stage
|
||||
ai_assert(false);
|
||||
|
|
|
@ -221,7 +221,7 @@ bool IntersectsBoundaryProfile( const IfcVector3& e0, const IfcVector3& e1, cons
|
|||
const IfcFloat s = (x*e.y - e.x*y)/det;
|
||||
const IfcFloat t = (x*b.y - b.x*y)/det;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
const IfcVector3 check = b0 + b*s - (e0 + e*t);
|
||||
ai_assert((IfcVector2(check.x,check.y)).SquareLength() < 1e-5);
|
||||
#endif
|
||||
|
@ -417,7 +417,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
|||
IfcVector3 isectpos;
|
||||
const Intersect isect = extra_point_flag ? Intersect_No : IntersectSegmentPlane(p,n,e0,e1,isectpos);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
if (isect == Intersect_Yes) {
|
||||
const IfcFloat f = fabs((isectpos - p)*n);
|
||||
ai_assert(f < 1e-5);
|
||||
|
|
|
@ -550,7 +550,7 @@ Curve* Curve :: Convert(const IFC::IfcCurve& curve,ConversionData& conv)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool Curve :: InRange(IfcFloat u) const
|
||||
{
|
||||
|
|
|
@ -1063,7 +1063,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
|
|||
if(!ok) {
|
||||
return IfcMatrix4();
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
const IfcFloat det = m.Determinant();
|
||||
ai_assert(fabs(det-1) < 1e-5);
|
||||
#endif
|
||||
|
@ -1119,7 +1119,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
|
|||
m = mult * m;
|
||||
|
||||
// debug code to verify correctness
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
std::vector<IfcVector2> out_contour2;
|
||||
BOOST_FOREACH(const IfcVector3& x, in_verts) {
|
||||
const IfcVector3& vv = m * x;
|
||||
|
|
|
@ -193,7 +193,7 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
|
|||
temp[cnt++] = v.x;
|
||||
temp[cnt++] = v.y;
|
||||
temp[cnt++] = v.z;
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
temp[cnt] = std::numeric_limits<IfcFloat>::quiet_NaN();
|
||||
#endif
|
||||
++cnt;
|
||||
|
|
|
@ -365,7 +365,7 @@ public:
|
|||
// and append the result to the mesh
|
||||
virtual void SampleDiscrete(TempMesh& out,IfcFloat start,IfcFloat end) const;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
// check if a particular parameter value lies within the well-defined range
|
||||
bool InRange(IfcFloat) const;
|
||||
#endif
|
||||
|
|
|
@ -232,7 +232,7 @@ aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|||
|
||||
for(std::set<std::string>::const_iterator it = st.begin(); it != st.end(); ++it) {
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
if (IsExtensionSupported(*it)) {
|
||||
DefaultLogger::get()->warn("The file extension " + *it + " is already in use");
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ void WriteLogOpening(const std::string& file)
|
|||
<< "<unknown compiler>"
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
<< " debug"
|
||||
#endif
|
||||
|
||||
|
@ -749,7 +749,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|||
}
|
||||
}
|
||||
#endif // no validation
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
if (pimpl->bExtraVerbose)
|
||||
{
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
|
@ -783,7 +783,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|||
if( !pimpl->mScene) {
|
||||
break;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
continue;
|
||||
|
|
|
@ -294,7 +294,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
|
|||
unsigned int vUVChannelIndices[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
unsigned int vVColorIndices[AI_MAX_NUMBER_OF_COLOR_SETS];
|
||||
|
||||
#if _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) {
|
||||
vUVChannelIndices[mui] = UINT_MAX;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ struct FaceWithSmoothingGroup
|
|||
{
|
||||
// let the rest uninitialized for performance - in release builds.
|
||||
// in debug builds set all indices to a common magic value
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
this->mIndices[0] = 0xffffffff;
|
||||
this->mIndices[1] = 0xffffffff;
|
||||
this->mIndices[2] = 0xffffffff;
|
||||
|
|
|
@ -329,7 +329,7 @@ unsigned int SpatialSort::GenerateMappingTable(std::vector<unsigned int>& fill,f
|
|||
++t;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
|
||||
// debug invariant: mPositions[i].mIndex values must range from 0 to mPositions.size()-1
|
||||
for (size_t i = 0; i < fill.size(); ++i) {
|
||||
|
|
|
@ -383,7 +383,7 @@ void CatmullClarkSubdivider::InternSubdivide (
|
|||
}
|
||||
|
||||
// check the other way round for consistency
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
|
||||
for (size_t t = 0; t < ofsadjvec.size()-1; ++t) {
|
||||
for (unsigned int m = 0; m < cntadjfac[t]; ++m) {
|
||||
|
@ -530,7 +530,7 @@ void CatmullClarkSubdivider::InternSubdivide (
|
|||
|
||||
ai_assert(adj[o]-moffsets[nidx].first < mp->mNumFaces);
|
||||
const aiFace& f = mp->mFaces[adj[o]-moffsets[nidx].first];
|
||||
# ifdef _DEBUG
|
||||
# ifdef ASSIMP_BUILD_DEBUG
|
||||
bool haveit = false;
|
||||
# endif
|
||||
|
||||
|
@ -553,7 +553,7 @@ void CatmullClarkSubdivider::InternSubdivide (
|
|||
// fixme: replace with mod face.mNumIndices?
|
||||
R += c0.midpoint+c1.midpoint;
|
||||
|
||||
# ifdef _DEBUG
|
||||
# ifdef ASSIMP_BUILD_DEBUG
|
||||
haveit = true;
|
||||
# endif
|
||||
break;
|
||||
|
|
|
@ -86,7 +86,7 @@ AI_WONT_RETURN void ValidateDSProcess::ReportError(const char* msg,...)
|
|||
ai_assert(iLen > 0);
|
||||
|
||||
va_end(args);
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
ai_assert( false );
|
||||
#endif
|
||||
throw DeadlyImportError("Validation failed: " + std::string(szBuffer,iLen));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef AI_DEBUG_H_INC
|
||||
#define AI_DEBUG_H_INC
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
# include <assert.h>
|
||||
# define ai_assert(expression) assert(expression)
|
||||
#else
|
||||
|
|
|
@ -242,7 +242,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
# define AI_C_THREADSAFE
|
||||
#endif // !! ASSIMP_BUILD_SINGLETHREADED
|
||||
|
||||
#ifdef _DEBUG
|
||||
#if defined(_DEBUG) || ! defined(NDEBUG)
|
||||
# define ASSIMP_BUILD_DEBUG
|
||||
#endif
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ struct aiString
|
|||
{
|
||||
data[0] = '\0';
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
// Debug build: overwrite the string on its full length with ESC (27)
|
||||
memset(data+1,27,MAXLEN-1);
|
||||
#endif
|
||||
|
@ -342,7 +342,7 @@ struct aiString
|
|||
length = 0;
|
||||
data[0] = '\0';
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
// Debug build: overwrite the string on its full length with ESC (27)
|
||||
memset(data+1,27,MAXLEN-1);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue