Skip to content

refactor: Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override#2394

Open
bobtista wants to merge 13 commits intoTheSuperHackers:mainfrom
bobtista:bobtista/override-keyword-tools
Open

refactor: Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override#2394
bobtista wants to merge 13 commits intoTheSuperHackers:mainfrom
bobtista:bobtista/override-keyword-tools

Conversation

@bobtista
Copy link
Copy Markdown

@bobtista bobtista commented Mar 3, 2026

Summary

Context

Part 6/6 of splitting #2101. Depends on #2389 merging first.

Notes

  • 201 files changed
  • All lines retain the virtual keyword
  • The -Wsuggest-override compiler warning ensures future virtual overrides use the keyword

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR mechanically adds the override keyword to virtual function overrides across 201 tool and header files in the Generals, GeneralsMD, and Core trees, and enables the -Wsuggest-override compiler warning for GCC/Clang non-VS6 builds. It also fixes a missed case from #2392 by adding the virtual keyword to ParticleSystemManagerDummy overrides in ParticleSys.h.

The vast majority of changes are correct and consistent. One minor gap: the dumpModelAssets and dumpAssetUsage stub overrides inside #if defined(RTS_DEBUG) blocks in both GUIEditDisplay.h files were skipped, even though the corresponding pure-virtual declarations in the Display base class are also guarded by the same preprocessor condition.

Confidence Score: 5/5

Safe to merge; all changes are purely additive override annotations with no behavioral changes.

The single finding is P2 (missing override in debug-only stub bodies in MSVC-only tool files), which does not affect correctness or runtime behavior and does not block merging.

Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h and GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h have two override-less stubs in their #if defined(RTS_DEBUG) blocks.

Important Files Changed

Filename Overview
cmake/compilers.cmake Adds -Wsuggest-override for non-MSVC, non-VS6 GCC/Clang builds in the existing compiler flag block.
Core/GameEngine/Include/GameClient/ParticleSys.h Adds missing virtual keyword to ParticleSystemManagerDummy overrides that already had override; fixes an inconsistency from #2392.
Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h Adds override and virtual to all Display overrides; dumpModelAssets and dumpAssetUsage inside #if defined(RTS_DEBUG) blocks are still missing override.
GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h Same as Generals counterpart — dumpModelAssets and dumpAssetUsage in debug-guarded blocks are missing override.
Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp Adds override to all view stub overrides; also correctly adds const to isZoomLimited to match the base class View signature.
GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp Mirror of Generals wbview3d.cpp changes with GeneralsMD-specific extended camera API signatures receiving override.
GeneralsMD/Code/Tools/wdump/wdump.cpp Adds override to ParseParam in CWDumpCommandLineInfo and DoDataExchange in CAboutDlg.
Generals/Code/Tools/WorldBuilder/include/CUndoable.h Adds virtual and override to destructors and Do/Undo/Redo overrides across all Undoable subclasses.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[cmake/compilers.cmake] -->|adds -Wsuggest-override| B[GCC/Clang non-VS6 builds]
    C[PR #2394 override refactor] --> D[Tools: WorldBuilder headers]
    C --> E[Tools: GUIEdit headers]
    C --> F[Tools: wdump.cpp]
    C --> G[Core: ParticleSys.h]
    D -->|add override keyword| H[Virtual overrides in ~90 WB headers]
    E -->|add override keyword| I[GUIEditDisplay + GUIEditWindowManager]
    F -->|add override keyword| J[ParseParam + DoDataExchange]
    G -->|add virtual keyword| K[ParticleSystemManagerDummy 6 methods]
    I -->|missing override| L[dumpModelAssets / dumpAssetUsage in RTS_DEBUG blocks]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h
Line: 118-123

Comment:
**Missing `override` in `#if defined(RTS_DEBUG)` blocks**

Both `dumpModelAssets` and `dumpAssetUsage` are declared as pure virtual in `Display` (also guarded by `#if defined(RTS_DEBUG)`), but neither received `override` in this PR. The same issue exists in `GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h`. With `-Wsuggest-override` now active for GCC/Clang builds, these would produce warnings if the tools are ever compiled outside of MSVC.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (9): Last reviewed commit: "fix: Add missing override keyword to Pla..." | Re-trigger Greptile

@xezon xezon added the Refactor Edits the code with insignificant behavior changes, is never user facing label Mar 10, 2026
@bobtista bobtista force-pushed the bobtista/override-keyword-tools branch from 1630354 to b7df0dc Compare March 11, 2026 01:48
@Skyaero42
Copy link
Copy Markdown

Might want to do a quick spacing check before I review?

@bobtista
Copy link
Copy Markdown
Author

Might want to do a quick spacing check before I review?

Looks good - found some mixed tab/space stuff for indentation but the override {} spacing seems good

Copy link
Copy Markdown

@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.

This looks good

@xezon xezon changed the title refactor(Tools): Add override keyword and -Wsuggest-override warning refactor(Tools): Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override Mar 17, 2026
@xezon xezon changed the title refactor(Tools): Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override refactor: Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override Mar 17, 2026
@bobtista bobtista force-pushed the bobtista/override-keyword-tools branch from ee24d63 to 58990fc Compare March 26, 2026 19:10
@xezon
Copy link
Copy Markdown

xezon commented Mar 29, 2026

@bobtista greptile says:

The PR is a mechanical refactor with no logic changes. The sole substantive issue is that four PlaceholderView overrides in both wbview3d.cpp files are missing override

@xezon
Copy link
Copy Markdown

xezon commented Apr 6, 2026

There still is an open comment.

@Caball009
Copy link
Copy Markdown

I need another look to verify, but I think there are some override related changes missing both in tools and the rest of the code.

@bobtista
Copy link
Copy Markdown
Author

bobtista commented Apr 6, 2026

There still is an open comment.

ah ok found it, addressed the 4 missing keywords

@xezon xezon requested a review from Caball009 April 7, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants