8000 refactor: Simplify unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH by Caball009 · Pull Request #2343 · TheSuperHackers/GeneralsGameCode · GitHub
[go: up one dir, main page]

Skip to content

refactor: Simplify unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH#2343

Merged
xezon merged 6 commits intoTheSuperHackers:mainfrom
Caball009:refactor_debug_assertions
Feb 23, 2026
Merged

refactor: Simplify unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH#2343
xezon merged 6 commits intoTheSuperHackers:mainfrom
Caball009:refactor_debug_assertions

Conversation

@Caball009
Copy link
@Caball009 Caball009 commented Feb 23, 2026

This PR changes occurrences such as DEBUG_ASSERTCRASH(FALSE, ("")) to DEBUG_CRASH(("")).

I used regex search and replace in VS22 with
from: DEBUG_ASSERTCRASH( *)\(( *)FALSE *, * (case insensitive)
to: DEBUG_CRASH$1($2

Edit: DEBUG_ASSERTCRASH( 0, ...) is now also included.

@Caball009 Caball009 added Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Refactor Edits the code with insignificant behavior changes, is never user facing Debug Is mostly debug functionality labels Feb 23, 2026
@greptile-apps
Copy link
greptile-apps bot commented Feb 23, 2026

Greptile Summary

Refactored unconditional debug assertions to use the more semantically appropriate DEBUG_CRASH macro across 89 files.

  • Replaced all instances of DEBUG_ASSERTCRASH(FALSE, (...)), DEBUG_ASSERTCRASH(0, (...)), and DEBUG_ASSERTCRASH(false, (...)) with DEBUG_CRASH((...))
  • The transformation is semantically correct: since DEBUG_ASSERTCRASH(condition, message) only crashes when the condition is false, passing FALSE/0/false makes it an unconditional crash, which is exactly what DEBUG_CRASH does
  • Applied via regex search-and-replace in VS22 with pattern DEBUG_ASSERTCRASH( *)\(( *)FALSE *, *DEBUG_CRASH$1($2 (case insensitive)
  • Total of 205 replacements across Core, Generals, and GeneralsMD directories
  • No logic changes, only improved code clarity by using the correct macro for unconditional crashes
  • Spacing and formatting preserved correctly in all replacements

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Purely mechanical refactoring with no behavioral changes. The transformation is semantically identical (unconditional assertions converted to unconditional crashes). All 205 replacements follow the same pattern and preserve existing functionality. No code logic, error handling, or program flow affected.
  • No files require special attention

Important Files Changed

Filename Overview
Core/GameEngine/Source/Common/INI/INI.cpp Replaced 7 unconditional assertions with DEBUG_CRASH for error handling
Core/GameEngine/Source/GameClient/GameText.cpp Replaced 12 unconditional assertions with DEBUG_CRASH for error handling
Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Replaced 15 unconditional assertions with DEBUG_CRASH for validation checks
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Replaced 15 unconditional assertions with DEBUG_CRASH for validation checks
Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Replaced 15 unconditional assertions with DEBUG_CRASH
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Replaced 15 unconditional assertions with DEBUG_CRASH

Last reviewed commit: cd5a821

@Caball009 Caball009 force-pushed the refactor_debug_assertions branch from 485769a to 314e068 Compare February 23, 2026 16:51
Copy link
@xezon xezon left a comment

Choose a reason for hiding this comment

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

Nice. While at it, also fix the DEBUG_ASSERTCRASH( 0, ...)

@Caball009
Copy link
Author

Nice. While at it, also fix the DEBUG_ASSERTCRASH( 0, ...)

Ah, I hadn't noticed those. I just 8000 changed them.

Copy link
@xezon xezon left a comment

Choose a reason for hiding this comment

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

Looking good.

@xezon xezon changed the title refactor(assertions): Change unconditional debug assertions from DEBUG_ASSERTCRASH to DEBUG_CRASH refactor: Change unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH Feb 23, 2026
Copy link
@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

Agreed, this looks good.

@xezon xezon changed the title refactor: Change unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH refactor: Simplify unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH Feb 23, 2026
@xezon xezon merged commit 75d5937 into TheSuperHackers:main Feb 23, 2026
28 checks passed
@Caball009 Caball009 deleted the refactor_debug_assertions branch February 23, 2026 20:32
CookieLandProjects pushed a commit to CookieLandProjects/CLP_AI that referenced this pull request Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Debug Is mostly debug functionality Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0