From 502e346eb6d063b4f54a4b0926e06c9d1958f5fb Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Sat, 15 Mar 2014 11:38:53 +0100 Subject: [PATCH 1/4] visual studio 2012 Level 4 warning fixes --- Engine/source/T3D/shapeBase.cpp | 4 ++-- Engine/source/console/CMDscan.cpp | 7 +++++-- Engine/source/console/cmdgram.cpp | 7 ------- Engine/source/console/consoleFunctions.cpp | 2 +- Engine/source/core/strings/stringFunctions.cpp | 6 +++--- Engine/source/core/util/journal/journal.h | 2 ++ Engine/source/platform/platformCPUCount.cpp | 13 +++++-------- Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 2 +- 8 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 58f04cee9..571b3c163 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -3158,9 +3158,9 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFlag(image.triggerDown); stream->writeFlag(image.altTriggerDown); - for (U32 i=0; iwriteFlag(image.genericTrigger[i]); + stream->writeFlag(image.genericTrigger[j]); } stream->writeInt(image.fireCount,3); diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 4ce606638..75f27dd72 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -1910,8 +1910,11 @@ extern int isatty (int ); b->yy_bs_column = 0; } - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - +#ifdef _MSC_VER + b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif // _MSC_VER errno = oerrno; } diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 35ed58bd0..0f6c8de71 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -2058,13 +2058,6 @@ yydestruct (yymsg, yytype, yyvaluep) if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } } diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 537f583ba..96f340f25 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -479,7 +479,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char if(!scan) { dStrcpy(ret + dstp, source + scanp); - return ret; + break; } U32 len = scan - (source + scanp); dStrncpy(ret + dstp, source + scanp, len); diff --git a/Engine/source/core/strings/stringFunctions.cpp b/Engine/source/core/strings/stringFunctions.cpp index 25c7e22b1..b84f378ff 100644 --- a/Engine/source/core/strings/stringFunctions.cpp +++ b/Engine/source/core/strings/stringFunctions.cpp @@ -108,7 +108,7 @@ compare_right(const nat_char* a, const nat_char* b) remember it in BIAS. */ for (;; a++, b++) { if (!nat_isdigit(*a) && !nat_isdigit(*b)) - return bias; + break; else if (!nat_isdigit(*a)) return -1; else if (!nat_isdigit(*b)) @@ -123,7 +123,7 @@ compare_right(const nat_char* a, const nat_char* b) return bias; } - return 0; + return bias; } @@ -134,7 +134,7 @@ compare_left(const nat_char* a, const nat_char* b) different value wins. */ for (;; a++, b++) { if (!nat_isdigit(*a) && !nat_isdigit(*b)) - return 0; + break; else if (!nat_isdigit(*a)) return -1; else if (!nat_isdigit(*b)) diff --git a/Engine/source/core/util/journal/journal.h b/Engine/source/core/util/journal/journal.h index 9db84e2f6..4df3a4ebb 100644 --- a/Engine/source/core/util/journal/journal.h +++ b/Engine/source/core/util/journal/journal.h @@ -407,6 +407,7 @@ public: { AssertFatal(IsPlaying(), "Journal::Read - not playing right now."); bool r = mFile->read(v); + TORQUE_UNUSED(r); AssertFatal(r, "Journal::Read - failed to read!"); } @@ -429,6 +430,7 @@ public: { AssertFatal(IsRecording(), "Journal::Write - not recording right now."); bool r = mFile->write(v); + TORQUE_UNUSED(r); AssertFatal(r, "Journal::Write - failed to write!"); } diff --git a/Engine/source/platform/platformCPUCount.cpp b/Engine/source/platform/platformCPUCount.cpp index 116251e08..3e3e3df11 100644 --- a/Engine/source/platform/platformCPUCount.cpp +++ b/Engine/source/platform/platformCPUCount.cpp @@ -99,12 +99,11 @@ namespace CPUInfo { // static unsigned int CpuIDSupported(void) { - unsigned int MaxInputValue; + unsigned int maxInputValue = 0; // If CPUID instruction is supported #ifdef TORQUE_COMPILER_GCC try { - MaxInputValue = 0; // call cpuid with eax = 0 asm ( @@ -112,7 +111,7 @@ namespace CPUInfo { "xorl %%eax,%%eax\n\t" "cpuid\n\t" "popl %%ebx\n\t" - : "=a" (MaxInputValue) + : "=a" (maxInputValue) : : "%ecx", "%edx" ); @@ -124,25 +123,23 @@ namespace CPUInfo { #elif defined( TORQUE_COMPILER_VISUALC ) try { - MaxInputValue = 0; // call cpuid with eax = 0 __asm { xor eax, eax cpuid - mov MaxInputValue, eax + mov maxInputValue, eax } } catch (...) { - return(0); // cpuid instruction is unavailable + // cpuid instruction is unavailable } #else # error Not implemented. #endif - return MaxInputValue; - + return maxInputValue; } diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index f7d2c740a..6c94e0743 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -800,7 +800,7 @@ void TerrainMacroMapFeatHLSL::processPix( Vector &componentL meta->addStatement( new GenOp( " @ *= @.y * @.w;\r\n", detailColor, detailInfo, inDet ) ); - Var *baseColor = (Var*)LangElement::find( "baseColor" ); + //Var *baseColor = (Var*)LangElement::find( "baseColor" ); Var *outColor = (Var*)LangElement::find( "col" ); meta->addStatement( new GenOp( " @ = lerp( @, @ + @, @ );\r\n", From 2844ab691226d05f949e24fd4e82ec1de901d541 Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Sat, 15 Mar 2014 11:51:36 +0100 Subject: [PATCH 2/4] more VS2012 L4 warning fixes --- Engine/source/console/cmdgram.cpp | 1 + Engine/source/console/simObject.cpp | 1 + Engine/source/core/util/str.cpp | 1 + Engine/source/core/util/zip/zipSubStream.cpp | 1 + Engine/source/environment/decalRoad.cpp | 1 + Engine/source/forest/forestDataFile.cpp | 1 + Engine/source/gfx/bitmap/loaders/bitmapPng.cpp | 2 ++ Engine/source/gui/containers/guiSplitContainer.cpp | 2 ++ .../lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp | 2 ++ Engine/source/math/mathTypes.cpp | 1 + Engine/source/platform/platformMemory.cpp | 6 ++---- Engine/source/platform/platformNet.cpp | 4 ++++ Engine/source/platform/profiler.cpp | 1 + Engine/source/scene/reflectionManager.cpp | 5 ++--- Engine/source/scene/zones/sceneZoneSpaceManager.cpp | 1 + Engine/source/sfx/sfxWorld.h | 1 + Engine/source/ts/tsCollision.cpp | 1 + Engine/source/ts/tsShape.cpp | 1 + Engine/source/ts/tsShapeAlloc.cpp | 4 +++- Engine/source/ts/tsThread.cpp | 1 + 20 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 0f6c8de71..33dc24203 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -2058,6 +2058,7 @@ yydestruct (yymsg, yytype, yyvaluep) if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + } diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 3385f3a91..bd7c7a035 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -1446,6 +1446,7 @@ 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; } diff --git a/Engine/source/core/util/str.cpp b/Engine/source/core/util/str.cpp index 9a89ef2a1..7b63de0f4 100644 --- a/Engine/source/core/util/str.cpp +++ b/Engine/source/core/util/str.cpp @@ -506,6 +506,7 @@ void* String::StringData::operator new( size_t size, U32 len ) void String::StringData::operator delete(void *ptr) { StringData* sub = static_cast(ptr); + TORQUE_UNUSED(sub); AssertFatal( sub->mRefCount == 0, "StringData::delete() - invalid refcount" ); #ifdef TORQUE_DEBUG diff --git a/Engine/source/core/util/zip/zipSubStream.cpp b/Engine/source/core/util/zip/zipSubStream.cpp index 4a38a955a..24049f609 100644 --- a/Engine/source/core/util/zip/zipSubStream.cpp +++ b/Engine/source/core/util/zip/zipSubStream.cpp @@ -436,6 +436,7 @@ 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"); } diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index 7bd240095..6ded02026 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -786,6 +786,7 @@ 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!" ); diff --git a/Engine/source/forest/forestDataFile.cpp b/Engine/source/forest/forestDataFile.cpp index a6c6d9062..ad42a0067 100644 --- a/Engine/source/forest/forestDataFile.cpp +++ b/Engine/source/forest/forestDataFile.cpp @@ -198,6 +198,7 @@ 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() ); } diff --git a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp index c0e05471c..952c5c279 100644 --- a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp +++ b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp @@ -76,6 +76,7 @@ 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!"); } @@ -89,6 +90,7 @@ 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!"); } diff --git a/Engine/source/gui/containers/guiSplitContainer.cpp b/Engine/source/gui/containers/guiSplitContainer.cpp index cf6cab46e..9fa18a210 100644 --- a/Engine/source/gui/containers/guiSplitContainer.cpp +++ b/Engine/source/gui/containers/guiSplitContainer.cpp @@ -350,6 +350,8 @@ bool GuiSplitContainer::resize( const Point2I &newPosition, const Point2I &newEx GuiContainer *panelTwo = dynamic_cast( 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. diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index c2bf42834..db18fe32b 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -475,6 +475,8 @@ void DeferredPixelSpecularHLSL::processPix( Vector &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!" ); diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index cbe123452..d8bf56a31 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -514,6 +514,7 @@ 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 diff --git a/Engine/source/platform/platformMemory.cpp b/Engine/source/platform/platformMemory.cpp index 925a15422..3ad831dc1 100644 --- a/Engine/source/platform/platformMemory.cpp +++ b/Engine/source/platform/platformMemory.cpp @@ -798,19 +798,17 @@ void checkPtr( void* ptr ) AllocatedHeader* header = ( AllocatedHeader* ) *iter; if( header->getUserPtr() == ptr ) { - char buffer[ 1024 ]; - #ifdef TORQUE_DEBUG_GUARD + char buffer[ 1024 ]; if( !checkGuard( *iter, true ) ) { dSprintf( buffer, sizeof( buffer ), "0x%x is a valid heap pointer but has its guards corrupted", ptr ); Platform::outputDebugString( buffer ); return; } -#endif - //dSprintf( buffer, sizeof( buffer ), "0x%x is a valid heap pointer", ptr ); //Platform::outputDebugString( buffer ); +#endif return; } } diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 786fcf62d..d957949e2 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -27,7 +27,11 @@ #define TORQUE_USE_WINSOCK #include #include + +#ifndef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS +#endif // EINPROGRESS + #define ioctl ioctlsocket typedef int socklen_t; diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index f97100f09..e68985b4f 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -623,6 +623,7 @@ 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]; diff --git a/Engine/source/scene/reflectionManager.cpp b/Engine/source/scene/reflectionManager.cpp index c6b78ad65..3fd24648a 100644 --- a/Engine/source/scene/reflectionManager.cpp +++ b/Engine/source/scene/reflectionManager.cpp @@ -189,11 +189,8 @@ void ReflectionManager::update( F32 timeSlice, break; } - U32 totalElapsed = mTimer->getElapsedMs(); - // Set metric/debug related script variables... - U32 numEnabled = mReflectors.size(); U32 numVisible = 0; U32 numOccluded = 0; @@ -208,6 +205,8 @@ void ReflectionManager::update( F32 timeSlice, } #ifdef TORQUE_GATHER_METRICS + U32 numEnabled = mReflectors.size(); + U32 totalElapsed = mTimer->getElapsedMs(); const GFXTextureProfileStats &stats = ReflectRenderTargetProfile.getStats(); F32 mb = ( stats.activeBytes / 1024.0f ) / 1024.0f; diff --git a/Engine/source/scene/zones/sceneZoneSpaceManager.cpp b/Engine/source/scene/zones/sceneZoneSpaceManager.cpp index ab0fa6ebe..8fd1f6963 100644 --- a/Engine/source/scene/zones/sceneZoneSpaceManager.cpp +++ b/Engine/source/scene/zones/sceneZoneSpaceManager.cpp @@ -901,6 +901,7 @@ 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!" ); diff --git a/Engine/source/sfx/sfxWorld.h b/Engine/source/sfx/sfxWorld.h index 2806cc4c8..68309492b 100644 --- a/Engine/source/sfx/sfxWorld.h +++ b/Engine/source/sfx/sfxWorld.h @@ -303,6 +303,7 @@ 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 diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index bb57bf1c5..2219f7c72 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1512,6 +1512,7 @@ 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. diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 726efabff..4365aa9b1 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -390,6 +390,7 @@ void TSShape::getObjectDetails(S32 objIndex, Vector& objDetails) void TSShape::init() { S32 numSubShapes = subShapeFirstNode.size(); + TORQUE_UNUSED(numSubShapes); AssertFatal(numSubShapes==subShapeFirstObject.size(),"TSShape::init"); S32 i,j; diff --git a/Engine/source/ts/tsShapeAlloc.cpp b/Engine/source/ts/tsShapeAlloc.cpp index 8908b84cf..b9cb166dc 100644 --- a/Engine/source/ts/tsShapeAlloc.cpp +++ b/Engine/source/ts/tsShapeAlloc.cpp @@ -213,7 +213,9 @@ 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())); diff --git a/Engine/source/ts/tsThread.cpp b/Engine/source/ts/tsThread.cpp index 7cb543c9e..1a8f8a3d5 100644 --- a/Engine/source/ts/tsThread.cpp +++ b/Engine/source/ts/tsThread.cpp @@ -163,6 +163,7 @@ 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."); From 489106ae5e83988975429e16885a0c4b722d32ca Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Sat, 15 Mar 2014 12:50:38 +0100 Subject: [PATCH 3/4] replaced UNUSED and assert combination by a fixed up assert macro - thanks luis! :) --- Engine/source/console/simObject.cpp | 1 - Engine/source/core/util/journal/journal.h | 2 -- Engine/source/core/util/str.cpp | 1 - Engine/source/core/util/zip/zipSubStream.cpp | 1 - Engine/source/environment/decalRoad.cpp | 1 - Engine/source/forest/forestDataFile.cpp | 1 - Engine/source/gfx/bitmap/loaders/bitmapPng.cpp | 2 -- Engine/source/gui/containers/guiSplitContainer.cpp | 2 -- .../lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp | 2 -- Engine/source/math/mathTypes.cpp | 1 - Engine/source/platform/platformAssert.h | 4 ++-- Engine/source/platform/profiler.cpp | 1 - Engine/source/platform/types.h | 2 +- Engine/source/scene/zones/sceneZoneSpaceManager.cpp | 1 - Engine/source/sfx/sfxWorld.h | 1 - Engine/source/ts/tsCollision.cpp | 1 - Engine/source/ts/tsShape.cpp | 1 - Engine/source/ts/tsShapeAlloc.cpp | 3 --- Engine/source/ts/tsThread.cpp | 1 - 19 files changed, 3 insertions(+), 26 deletions(-) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index bd7c7a035..3385f3a91 100644 --- a/Engine/source/console/simObject.cpp +++ b/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; } diff --git a/Engine/source/core/util/journal/journal.h b/Engine/source/core/util/journal/journal.h index 4df3a4ebb..9db84e2f6 100644 --- a/Engine/source/core/util/journal/journal.h +++ b/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!"); } diff --git a/Engine/source/core/util/str.cpp b/Engine/source/core/util/str.cpp index 7b63de0f4..9a89ef2a1 100644 --- a/Engine/source/core/util/str.cpp +++ b/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(ptr); - TORQUE_UNUSED(sub); AssertFatal( sub->mRefCount == 0, "StringData::delete() - invalid refcount" ); #ifdef TORQUE_DEBUG diff --git a/Engine/source/core/util/zip/zipSubStream.cpp b/Engine/source/core/util/zip/zipSubStream.cpp index 24049f609..4a38a955a 100644 --- a/Engine/source/core/util/zip/zipSubStream.cpp +++ b/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"); } diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index 6ded02026..7bd240095 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/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!" ); diff --git a/Engine/source/forest/forestDataFile.cpp b/Engine/source/forest/forestDataFile.cpp index ad42a0067..a6c6d9062 100644 --- a/Engine/source/forest/forestDataFile.cpp +++ b/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() ); } diff --git a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp index 952c5c279..c0e05471c 100644 --- a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp +++ b/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!"); } diff --git a/Engine/source/gui/containers/guiSplitContainer.cpp b/Engine/source/gui/containers/guiSplitContainer.cpp index 9fa18a210..cf6cab46e 100644 --- a/Engine/source/gui/containers/guiSplitContainer.cpp +++ b/Engine/source/gui/containers/guiSplitContainer.cpp @@ -350,8 +350,6 @@ bool GuiSplitContainer::resize( const Point2I &newPosition, const Point2I &newEx GuiContainer *panelTwo = dynamic_cast( 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. diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index db18fe32b..c2bf42834 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -475,8 +475,6 @@ void DeferredPixelSpecularHLSL::processPix( Vector &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!" ); diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index d8bf56a31..cbe123452 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/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 diff --git a/Engine/source/platform/platformAssert.h b/Engine/source/platform/platformAssert.h index 4865d387c..60ed7d3d5 100644 --- a/Engine/source/platform/platformAssert.h +++ b/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 /*! diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index e68985b4f..f97100f09 100644 --- a/Engine/source/platform/profiler.cpp +++ b/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]; diff --git a/Engine/source/platform/types.h b/Engine/source/platform/types.h index c53bd87fc..720010e91 100644 --- a/Engine/source/platform/types.h +++ b/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 diff --git a/Engine/source/scene/zones/sceneZoneSpaceManager.cpp b/Engine/source/scene/zones/sceneZoneSpaceManager.cpp index 8fd1f6963..ab0fa6ebe 100644 --- a/Engine/source/scene/zones/sceneZoneSpaceManager.cpp +++ b/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!" ); diff --git a/Engine/source/sfx/sfxWorld.h b/Engine/source/sfx/sfxWorld.h index 68309492b..2806cc4c8 100644 --- a/Engine/source/sfx/sfxWorld.h +++ b/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 diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 2219f7c72..bb57bf1c5 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/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. diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 4365aa9b1..726efabff 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -390,7 +390,6 @@ void TSShape::getObjectDetails(S32 objIndex, Vector& objDetails) void TSShape::init() { S32 numSubShapes = subShapeFirstNode.size(); - TORQUE_UNUSED(numSubShapes); AssertFatal(numSubShapes==subShapeFirstObject.size(),"TSShape::init"); S32 i,j; diff --git a/Engine/source/ts/tsShapeAlloc.cpp b/Engine/source/ts/tsShapeAlloc.cpp index b9cb166dc..b9f461c99 100644 --- a/Engine/source/ts/tsShapeAlloc.cpp +++ b/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())); diff --git a/Engine/source/ts/tsThread.cpp b/Engine/source/ts/tsThread.cpp index 1a8f8a3d5..7cb543c9e 100644 --- a/Engine/source/ts/tsThread.cpp +++ b/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."); From 8c25dc8b18eeb22aa71ba31929c186e57a370d10 Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Sat, 15 Mar 2014 12:57:47 +0100 Subject: [PATCH 4/4] reverted fileno change, MSVS specific API changes follow in another PR --- Engine/source/console/CMDscan.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 75f27dd72..f81c040a4 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -1910,11 +1910,7 @@ extern int isatty (int ); b->yy_bs_column = 0; } -#ifdef _MSC_VER - b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0; -#else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif // _MSC_VER errno = oerrno; }