浏览代码

replaced UNUSED and assert combination by a fixed up assert macro - thanks luis! :)

Thomas Fischer 11 年之前
父节点
当前提交
489106ae5e

+ 0 - 1
Engine/source/console/simObject.cpp

@@ -1446,7 +1446,6 @@ void SimObject::linkNamespaces()
          // No increasing parent reference counts is needed in this case.
 
          bool ok = superClassNamespacePackageRoot->classLinkTo( cppNamespace );
-         TORQUE_UNUSED(ok);
          AssertFatal( ok, "SimObject::linkNamespaces - failed to link new namespace to c++ class name" );
          parentNamespace = superClassNamespace;
       }

+ 0 - 2
Engine/source/core/util/journal/journal.h

@@ -407,7 +407,6 @@ public:
    {
       AssertFatal(IsPlaying(), "Journal::Read - not playing right now.");
       bool r = mFile->read(v);
-      TORQUE_UNUSED(r);
       AssertFatal(r, "Journal::Read - failed to read!");
    }
 
@@ -430,7 +429,6 @@ public:
    {
       AssertFatal(IsRecording(), "Journal::Write - not recording right now.");
       bool r = mFile->write(v);
-      TORQUE_UNUSED(r);
       AssertFatal(r, "Journal::Write - failed to write!");
    }
 

+ 0 - 1
Engine/source/core/util/str.cpp

@@ -506,7 +506,6 @@ void* String::StringData::operator new( size_t size, U32 len )
 void String::StringData::operator delete(void *ptr)
 {
    StringData* sub = static_cast<StringData *>(ptr);
-   TORQUE_UNUSED(sub);
    AssertFatal( sub->mRefCount == 0, "StringData::delete() - invalid refcount" );
 
 #ifdef TORQUE_DEBUG

+ 0 - 1
Engine/source/core/util/zip/zipSubStream.cpp

@@ -436,7 +436,6 @@ bool ZipSubWStream::_write(const U32 numBytes, const void *pBuffer)
       }
 
       S32 retVal = deflate(m_pZipStream, Z_NO_FLUSH);
-      TORQUE_UNUSED(retVal);
       AssertFatal(retVal !=  Z_BUF_ERROR, "ZipSubWStream::_write: invalid buffer");
    }
 

+ 0 - 1
Engine/source/environment/decalRoad.cpp

@@ -786,7 +786,6 @@ void DecalRoad::prepRenderImage( SceneRenderState* state )
       U32 idxCount = ( endBatch.endIndex - startIdx ) + 1;
       U32 triangleCount = idxCount / 3;
 
-      TORQUE_UNUSED(vertCount);
       AssertFatal( startVert + vertCount <= mVertCount, "DecalRoad, bad draw call!" );
       AssertFatal( startIdx + triangleCount < mTriangleCount * 3, "DecalRoad, bad draw call!" );
 

+ 0 - 1
Engine/source/forest/forestDataFile.cpp

@@ -198,7 +198,6 @@ bool ForestData::write( const char *path )
    for ( U32 i=0; i < count; i++ )
    {
       StringTableEntry localName = allDatablocks[i]->getInternalName();
-      TORQUE_UNUSED(localName);
       AssertFatal( localName != NULL && localName[0] != '\0', "ForestData::write - ForestItemData had no internal name set!" );
       stream.writeString( allDatablocks[i]->getInternalName() );
    }

+ 0 - 2
Engine/source/gfx/bitmap/loaders/bitmapPng.cpp

@@ -76,7 +76,6 @@ static void pngReadDataFn(png_structp png_ptr,
 
    Stream *strm = (Stream*)png_get_io_ptr(png_ptr);
    bool success = strm->read(length, data);
-   TORQUE_UNUSED(success);
    AssertFatal(success, "pngReadDataFn - failed to read from stream!");
 }
 
@@ -90,7 +89,6 @@ static void pngWriteDataFn(png_structp png_ptr,
 
    Stream *strm = (Stream*)png_get_io_ptr(png_ptr);
    bool success = strm->write(length, data);
-   TORQUE_UNUSED(success);
    AssertFatal(success, "pngWriteDataFn - failed to write to stream!");
 }
 

+ 0 - 2
Engine/source/gui/containers/guiSplitContainer.cpp

@@ -350,8 +350,6 @@ bool GuiSplitContainer::resize( const Point2I &newPosition, const Point2I &newEx
    GuiContainer *panelTwo = dynamic_cast<GuiContainer*>( at(1) );
 	
    // 
-   TORQUE_UNUSED(panelOne);
-   TORQUE_UNUSED(panelTwo);
    AssertFatal( panelOne && panelTwo, "GuiSplitContainer::resize - Missing/Invalid Subordinate Controls! Split contained controls must derive from GuiContainer!" );
 
    // We only need to update the split point if our second panel is fixed.  

+ 0 - 2
Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp

@@ -475,8 +475,6 @@ void DeferredPixelSpecularHLSL::processPix(  Vector<ShaderComponent*> &component
    Var *d_specular = (Var*)LangElement::find( "d_specular" );
    Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
 
-   TORQUE_UNUSED(lightInfoSamp);
-   TORQUE_UNUSED(d_NL_Att);
    AssertFatal( lightInfoSamp && d_specular && d_NL_Att,
       "DeferredPixelSpecularHLSL::processPix - Something hosed the deferred features!" );
 

+ 0 - 1
Engine/source/math/mathTypes.cpp

@@ -514,7 +514,6 @@ ConsoleSetType( TypeBox3F )
       U32 args = dSscanf(argv[0], "%g %g %g %g %g %g",
                          &pDst->minExtents.x, &pDst->minExtents.y, &pDst->minExtents.z,
                          &pDst->maxExtents.x, &pDst->maxExtents.y, &pDst->maxExtents.z);
-      TORQUE_UNUSED(args);
       AssertWarn(args == 6, "Warning, box probably not read properly");
    } 
    else 

+ 2 - 2
Engine/source/platform/platformAssert.h

@@ -96,8 +96,8 @@ public:
             { if ( ::PlatformAssert::processAssert(::PlatformAssert::Fatal, __FILE__, __LINE__,  y) ) { ::Platform::debugBreak(); } } }
 
 #else
-   #define AssertFatal(x, y)   { (void)sizeof(x); (void)sizeof(y); }
-   #define AssertWarn(x, y)    { (void)sizeof(x); (void)sizeof(y); }
+   #define AssertFatal(x, y)   { TORQUE_UNUSED(x); TORQUE_UNUSED(y); }
+   #define AssertWarn(x, y)    { TORQUE_UNUSED(x); TORQUE_UNUSED(y); }
 #endif
 
 /*!

+ 0 - 1
Engine/source/platform/profiler.cpp

@@ -623,7 +623,6 @@ void Profiler::dump()
    {
       FileStream fws;
       bool success = fws.open(mDumpFileName, Torque::FS::File::Write);
-      TORQUE_UNUSED(success);
       AssertFatal(success, "Cannot write profile dump to specified file!");
          char buffer[1024];
 

+ 1 - 1
Engine/source/platform/types.h

@@ -40,7 +40,7 @@ typedef double             F64;     ///< Compiler independent 64-bit float
 
 struct EmptyType {};             ///< "Null" type used by templates
 
-#define TORQUE_UNUSED(var) (void)var
+#define TORQUE_UNUSED(var) (void)(var)
 
 //------------------------------------------------------------------------------
 //------------------------------------- String Types

+ 0 - 1
Engine/source/scene/zones/sceneZoneSpaceManager.cpp

@@ -901,7 +901,6 @@ void SceneZoneSpaceManager::verifyState()
             continue;
 
          SceneZoneSpace* otherSpace = mZoneSpaces[ n ];
-         TORQUE_UNUSED(otherSpace);
          AssertFatal( otherSpace->getZoneRangeStart() >= zoneRangeStart + numZones ||
                       otherSpace->getZoneRangeStart() + otherSpace->getZoneRange() <= zoneRangeStart,
             "SceneZoneSpaceManager::verifyState - Overlap between zone ID ranges of zone spaces!" );

+ 0 - 1
Engine/source/sfx/sfxWorld.h

@@ -303,7 +303,6 @@ void SFXWorld< NUM_DIMENSIONS, Object >::update()
       else
       {
          SFXAmbience* ambience = Deref( scope.mObject ).getAmbience();
-         TORQUE_UNUSED(ambience);
          AssertFatal( ambience != NULL, "SFXWorld::update() - object on stack that does not have an ambient space!" );
 
          // Listener is neither inside object nor in its

+ 0 - 1
Engine/source/ts/tsCollision.cpp

@@ -1512,7 +1512,6 @@ bool TSMesh::castRayOpcode( const Point3F &s, const Point3F &e, RayInfo *info, T
 
    // Do collision.
    bool safety = ray.Collide( vec, *mOptTree );
-   TORQUE_UNUSED(safety);
    AssertFatal( safety, "TSMesh::castRayOpcode - no good ray collide!" );
 
    // If no hit, just skip out.

+ 0 - 1
Engine/source/ts/tsShape.cpp

@@ -390,7 +390,6 @@ void TSShape::getObjectDetails(S32 objIndex, Vector<S32>& objDetails)
 void TSShape::init()
 {
    S32 numSubShapes = subShapeFirstNode.size();
-   TORQUE_UNUSED(numSubShapes);
    AssertFatal(numSubShapes==subShapeFirstObject.size(),"TSShape::init");
 
    S32 i,j;

+ 0 - 3
Engine/source/ts/tsShapeAlloc.cpp

@@ -213,9 +213,6 @@ void TSShapeAlloc::checkGuard()
    bool check32 = checkGuard32();
    bool check16 = checkGuard16();
    bool check8  = checkGuard8();
-   TORQUE_UNUSED(check32);
-   TORQUE_UNUSED(check16);
-   TORQUE_UNUSED(check8);
    AssertFatal(check32,avar("TSShapeAlloc::checkGuard32: found %i, wanted %i",getSaveGuard32(),getPrevGuard32()));
    AssertFatal(check16,avar("TSShapeAlloc::checkGuard16: found %i, wanted %i",getSaveGuard16(),getPrevGuard16()));
    AssertFatal(check8 ,avar("TSShapeAlloc::checkGuard8:  found %i, wanted %i",getSaveGuard8() ,getPrevGuard8()));

+ 0 - 1
Engine/source/ts/tsThread.cpp

@@ -163,7 +163,6 @@ void TSThread::setSequence(S32 seq, F32 toPos)
 {
    const TSShape * shape = mShapeInstance->mShape;
 
-   TORQUE_UNUSED(shape);
    AssertFatal(shape && shape->sequences.size()>seq && toPos>=0.0f && toPos<=1.0f,
       "TSThread::setSequence: invalid shape handle, sequence number, or position.");