Skip to content

Fix DEBUG_CRC compile errors and add RTS_DEBUG_CRC cmake option #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Generals/Code/GameEngine/Include/Common/CRCDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

#include "Common/Debug.h"

#ifndef NO_DEBUG_CRC
#ifdef NO_DEBUG_CRC
#undef DEBUG_CRC
#else
#ifdef DEBUG_LOGGING
#define DEBUG_CRC
#endif
Expand Down
4 changes: 1 addition & 3 deletions Generals/Code/GameEngine/Include/GameLogic/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,8 @@ class Object : public Thing, public Snapshot

}; // end class Object

#ifdef DEBUG_LOGGING
// describe an object as an AsciiString: e.g. "Object 102 (KillerBuggy) [GLARocketBuggy, owned by player 2 (GLAIntroPlayer)]"
AsciiString DescribeObject(const Object *obj);
#endif // DEBUG_LOGGING
AsciiString DebugDescribeObject(const Object *obj);

#if defined(_DEBUG) || defined(_INTERNAL)
#define DEBUG_OBJECT_ID_EXISTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ void Path::computePointOnPath(
ClosestPointOnPathInfo& out
)
{
CRCDEBUG_LOG(("Path::computePointOnPath() fzor %s\n", DescribeObject(obj).str()));
CRCDEBUG_LOG(("Path::computePointOnPath() for %s\n", DebugDescribeObject(obj).str()));

out.layer = LAYER_GROUND;
out.posOnPath.zero();
Expand Down
4 changes: 1 addition & 3 deletions Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ extern void addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBCo

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
#ifdef DEBUG_LOGGING
AsciiString DescribeObject(const Object *obj)
AsciiString DebugDescribeObject(const Object *obj)
{
if (!obj)
return "<No Object>";
Expand All @@ -167,7 +166,6 @@ AsciiString DescribeObject(const Object *obj)

return ret;
}
#endif // DEBUG_LOGGING

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2163,7 +2163,7 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void )
// obstacles, and follow the intermediate path points.
ClosestPointOnPathInfo info;
CRCDEBUG_LOG(("AIUpdateInterface::doLocomotor() - calling computePointOnPath() for %s\n",
DescribeObject(getObject()).str()));
DebugDescribeObject(getObject()).str()));
getPath()->computePointOnPath(getObject(), m_locomotorSet, *getObject()->getPosition(), info);
onPathDistToGoal = info.distAlongPath;
goalPos = info.posOnPath;
Expand Down
4 changes: 3 additions & 1 deletion GeneralsMD/Code/GameEngine/Include/Common/CRCDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

#include "Common/Debug.h"

#ifndef NO_DEBUG_CRC
#ifdef NO_DEBUG_CRC
#undef DEBUG_CRC
#else
#ifdef DEBUG_LOGGING
#define DEBUG_CRC
#endif
Expand Down
4 changes: 1 addition & 3 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,8 @@ class Object : public Thing, public Snapshot

}; // end class Object

#ifdef DEBUG_LOGGING
// describe an object as an AsciiString: e.g. "Object 102 (KillerBuggy) [GLARocketBuggy, owned by player 2 (GLAIntroPlayer)]"
AsciiString DescribeObject(const Object *obj);
#endif // DEBUG_LOGGING
AsciiString DebugDescribeObject(const Object *obj);

#if defined(_DEBUG) || defined(_INTERNAL)
#define DEBUG_OBJECT_ID_EXISTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ void Path::computePointOnPath(
ClosestPointOnPathInfo& out
)
{
CRCDEBUG_LOG(("Path::computePointOnPath() fzor %s\n", DescribeObject(obj).str()));
CRCDEBUG_LOG(("Path::computePointOnPath() for %s\n", DebugDescribeObject(obj).str()));

out.layer = LAYER_GROUND;
out.posOnPath.zero();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ extern void addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBCo

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
#ifdef DEBUG_LOGGING
AsciiString DescribeObject(const Object *obj)
AsciiString DebugDescribeObject(const Object *obj)
{
if (!obj)
return "<No Object>";
Expand All @@ -177,7 +176,6 @@ AsciiString DescribeObject(const Object *obj)

return ret;
}
#endif // DEBUG_LOGGING

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,7 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void )
// obstacles, and follow the intermediate path points.
ClosestPointOnPathInfo info;
CRCDEBUG_LOG(("AIUpdateInterface::doLocomotor() - calling computePointOnPath() for %s\n",
DescribeObject(getObject()).str()));
DebugDescribeObject(getObject()).str()));
getPath()->computePointOnPath(getObject(), m_locomotorSet, *getObject()->getPosition(), info);
onPathDistToGoal = info.distAlongPath;
goalPos = info.posOnPath;
Expand Down
23 changes: 11 additions & 12 deletions cmake/config-debug.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,33 @@ set_property(CACHE RTS_DEBUG_STACKTRACE PROPERTY STRINGS DEFAULT ON OFF)
set(RTS_DEBUG_PROFILE "DEFAULT" CACHE STRING "Enables debug profiling. When DEFAULT, this option is enabled with DEBUG or INTERNAL")
set_property(CACHE RTS_DEBUG_PROFILE PROPERTY STRINGS DEFAULT ON OFF)

option(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Include normal debug log in crc log" OFF)
set(RTS_DEBUG_CRC "DEFAULT" CACHE STRING "Enables debug CRC testing. When DEFAULT, this option is enabled with DEBUG_LOGGING")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug logging, not testing

set_property(CACHE RTS_DEBUG_CRC PROPERTY STRINGS DEFAULT ON OFF)


add_feature_info(DebugLogging RTS_DEBUG_LOGGING "Build with Debug Logging")
add_feature_info(DebugCrashing RTS_DEBUG_CRASHING "Build with Debug Crashing")
add_feature_info(DebugStacktrace RTS_DEBUG_STACKTRACE "Build with Debug Stacktracing")
add_feature_info(DebugProfile RTS_DEBUG_PROFILE "Build with Debug Profiling")
add_feature_info(DebugIncludeDebugLogInCrcLog RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Build with Debug Logging in CRC log")
option(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Includes normal debug log in CRC log" OFF)


# Helper macro that handles DEFAULT ON OFF options
macro(define_debug_option OptionName OptionEnabledCompileDef OptionDisabledCompileDef)
macro(define_debug_option OptionName OptionEnabledCompileDef OptionDisabledCompileDef FeatureInfoName FeatureInfoDescription)
if(${OptionName} STREQUAL "DEFAULT")
# Does nothing
elseif(${OptionName} STREQUAL "ON")
target_compile_definitions(core_config INTERFACE ${OptionEnabledCompileDef}=1)
add_feature_info(${FeatureInfoName} TRUE ${FeatureInfoDescription})
elseif(${OptionName} STREQUAL "OFF")
target_compile_definitions(core_config INTERFACE ${OptionDisabledCompileDef}=1)
add_feature_info(${FeatureInfoName} FALSE ${FeatureInfoDescription})
else()
message(FATAL_ERROR "Unhandled option")
endif()
endmacro()


define_debug_option(RTS_DEBUG_LOGGING DEBUG_LOGGING DISABLE_DEBUG_LOGGING )
define_debug_option(RTS_DEBUG_CRASHING DEBUG_CRASHING DISABLE_DEBUG_CRASHING )
define_debug_option(RTS_DEBUG_STACKTRACE DEBUG_STACKTRACE DISABLE_DEBUG_STACKTRACE)
define_debug_option(RTS_DEBUG_PROFILE DEBUG_PROFILE DISABLE_DEBUG_PROFILE )
define_debug_option(RTS_DEBUG_LOGGING DEBUG_LOGGING DISABLE_DEBUG_LOGGING DebugLogging "Build with Debug Logging")
define_debug_option(RTS_DEBUG_CRASHING DEBUG_CRASHING DISABLE_DEBUG_CRASHING DebugCrashing "Build with Debug Crashing")
define_debug_option(RTS_DEBUG_STACKTRACE DEBUG_STACKTRACE DISABLE_DEBUG_STACKTRACE DebugStacktrace "Build with Debug Stacktracing")
define_debug_option(RTS_DEBUG_PROFILE DEBUG_PROFILE DISABLE_DEBUG_PROFILE DebugProfile "Build with Debug Profiling")
define_debug_option(RTS_DEBUG_CRC DEBUG_CRC NO_DEBUG_CRC DebugCRC "Build with Debug CRC Testing")

if(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG)
target_compile_definitions(core_config INTERFACE INCLUDE_DEBUG_LOG_IN_CRC_LOG)
Expand Down
Loading