refactor: Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override#2394
Conversation
|
| 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]
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
1630354 to
b7df0dc
Compare
|
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 |
ee24d63 to
58990fc
Compare
|
@bobtista greptile says:
|
|
There still is an open comment. |
|
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. |
ah ok found it, addressed the 4 missing keywords |
Summary
overridekeyword to virtual function overrides in Tools (WorldBuilder, GUIEdit, wdump)-Wsuggest-overridecompiler warning for GCC and Clangvirtualkeyword toParticleSystemManagerDummyoverrides in Core (missed in refactor: Add override keyword to virtual function overrides in GameEngine (2) #2392 since the class was added after that PR merged)Context
Part 6/6 of splitting #2101. Depends on #2389 merging first.
Notes
virtualkeyword-Wsuggest-overridecompiler warning ensures future virtual overrides use the keyword