Skip to content

Commit ffac8f9

Browse files
refactor: Eliminate macro-split assignments (#2641)
1 parent 3c73dd0 commit ffac8f9

10 files changed

Lines changed: 22 additions & 44 deletions

File tree

Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,8 @@ void ArchiveFileSystem::loadMods()
230230

231231
if (TheGlobalData->m_modDir.isNotEmpty())
232232
{
233-
#ifdef DEBUG_LOGGING
234-
Bool ret =
235-
#endif
236-
loadBigFilesFromDirectory(TheGlobalData->m_modDir, "*.big", TRUE);
233+
MAYBE_UNUSED Bool ret = loadBigFilesFromDirectory(TheGlobalData->m_modDir, "*.big", TRUE);
234+
(void)ret;
237235
DEBUG_ASSERTLOG(ret, ("loadBigFilesFromDirectory(%s) returned FALSE!", TheGlobalData->m_modDir.str()));
238236
}
239237
}

Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,10 +808,8 @@ void StopAsyncDNSCheck()
808808
{
809809
if (s_asyncDNSThreadHandle)
810810
{
811-
#ifdef DEBUG_CRASHING
812-
Int res =
813-
#endif
814-
TerminateThread(s_asyncDNSThreadHandle,0);
811+
MAYBE_UNUSED Int res = TerminateThread(s_asyncDNSThreadHandle, 0);
812+
(void)res;
815813
DEBUG_ASSERTCRASH(res, ("Could not terminate the Async DNS Lookup thread!")); // Thread still not killed!
816814
}
817815
s_asyncDNSThreadHandle = nullptr;

Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,8 @@ void GameSpyInfo::markAsStagingRoomJoiner( Int game )
559559
GameSpyStagingRoom *info = it->second;
560560
info->cleanUpSlotPointers();
561561
AsciiString options = GameInfoToAsciiString(info);
562-
#ifdef DEBUG_CRASHING
563-
Bool res =
564-
#endif
565-
ParseAsciiStringToGameInfo(&m_localStagingRoom, options);
562+
MAYBE_UNUSED Bool res = ParseAsciiStringToGameInfo(&m_localStagingRoom, options);
563+
(void)res;
566564
DEBUG_ASSERTCRASH(res, ("Could not parse game info \"%s\"", options.str()));
567565
m_localStagingRoom.setInGame();
568566
m_localStagingRoom.setLocalName(m_localName);

Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,8 @@ void PSThreadClass::Thread_Function()
860860
if (tryConnect())
861861
{
862862
NewGame(0);
863-
#ifdef DEBUG_LOGGING
864-
Int res =
865-
#endif // DEBUG_LOGGING
866-
SendGameSnapShot(nullptr, req.results.c_str(), SNAP_FINAL);
863+
MAYBE_UNUSED Int res = SendGameSnapShot(nullptr, req.results.c_str(), SNAP_FINAL);
864+
(void)res;
867865
DEBUG_LOG(("Just sent game results - res was %d", res));
868866
FreeGame(nullptr);
869867
}

Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,8 @@ WWINLINE void Lock_Mem_Log_Mutex()
300300
#if MEMLOG_USE_MUTEX
301301

302302
void * mutex = Get_Mem_Log_Mutex();
303-
#ifdef DEBUG_CRASHING
304-
int res =
305-
#endif
306-
WaitForSingleObject(mutex,INFINITE);
303+
MAYBE_UNUSED int res = WaitForSingleObject(mutex,INFINITE);
304+
(void)res;
307305
WWASSERT(res==WAIT_OBJECT_0);
308306
_MemLogLockCounter++;
309307
#endif
@@ -344,10 +342,8 @@ WWINLINE void Unlock_Mem_Log_Mutex()
344342

345343
void * mutex = Get_Mem_Log_Mutex();
346344
_MemLogLockCounter--;
347-
#ifdef DEBUG_CRASHING
348-
int res=
349-
#endif
350-
ReleaseMutex(mutex);
345+
MAYBE_UNUSED int res = ReleaseMutex(mutex);
346+
(void)res;
351347
WWASSERT(res);
352348

353349
#endif

Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ Char* UnicodeToANSI(const WChar* string, Char* buffer, UInt bufferLength)
8989
return nullptr;
9090
}
9191

92-
#ifdef RTS_DEBUG
93-
int result =
94-
#endif
95-
WideCharToMultiByte(CP_ACP, 0, string, -1, buffer, bufferLength, nullptr, nullptr);
92+
MAYBE_UNUSED int result = WideCharToMultiByte(CP_ACP, 0, string, -1, buffer, bufferLength, nullptr, nullptr);
93+
(void)result;
9694

9795
#ifdef RTS_DEBUG
9896
if (result == 0)

Generals/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@ static void writeAtOffset(File* file, Int offset, const void* data, Int dataSize
7979
{
8080
file->write(data, dataSize);
8181
}
82-
#ifdef DEBUG_CRASHING
83-
Int res =
84-
#endif
85-
file->seek(fileSize, File::seekMode::START);
82+
MAYBE_UNUSED Int res = file->seek(fileSize, File::seekMode::START);
83+
(void)res;
8684
DEBUG_ASSERTCRASH(res == fileSize, ("Could not seek to end of file!"));
8785
}
8886

Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,8 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD
757757
CRCDEBUG_LOG(("Produced at helipad (door = %d)", exitDoor));
758758
DEBUG_ASSERTCRASH(exitDoor == DOOR_NONE_NEEDED, ("Hmm, unlikely"));
759759
Matrix3D mtx;
760-
#ifdef DEBUG_CRASHING
761-
Bool boneOk =
762-
#endif
763-
getObject()->getSingleLogicalBonePosition("HeliPark01", &ppinfo.hangarInternal, &mtx);
760+
MAYBE_UNUSED Bool boneOk = getObject()->getSingleLogicalBonePosition("HeliPark01", &ppinfo.hangarInternal, &mtx);
761+
(void)boneOk;
764762

765763
DEBUG_ASSERTCRASH(boneOk, ("Could not get bone!"));
766764
ppinfo.hangarInternalOrient = mtx.Get_Z_Rotation();

GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@ static void writeAtOffset(File* file, Int offset, const void* data, Int dataSize
7979
{
8080
file->write(data, dataSize);
8181
}
82-
#ifdef DEBUG_CRASHING
83-
Int res =
84-
#endif
85-
file->seek(fileSize, File::seekMode::START);
82+
MAYBE_UNUSED Int res = file->seek(fileSize, File::seekMode::START);
83+
(void)res;
8684
DEBUG_ASSERTCRASH(res == fileSize, ("Could not seek to end of file!"));
8785
}
8886

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,8 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD
820820
CRCDEBUG_LOG(("Produced at helipad (door = %d)", exitDoor));
821821
DEBUG_ASSERTCRASH(exitDoor == DOOR_NONE_NEEDED, ("Hmm, unlikely"));
822822
Matrix3D mtx;
823-
#ifdef DEBUG_CRASHING
824-
Bool boneOk =
825-
#endif
826-
getObject()->getSingleLogicalBonePosition("HeliPark01", &ppinfo.hangarInternal, &mtx);
823+
MAYBE_UNUSED Bool boneOk = getObject()->getSingleLogicalBonePosition("HeliPark01", &ppinfo.hangarInternal, &mtx);
824+
(void)boneOk;
827825

828826
DEBUG_ASSERTCRASH(boneOk, ("Could not get bone!"));
829827
ppinfo.hangarInternalOrient = mtx.Get_Z_Rotation();

0 commit comments

Comments
 (0)