Skip to content

Conversation

@bobtista
Copy link

@bobtista bobtista commented Jan 13, 2026

Summary

  • Apply clang-tidy cppcoreguidelines-explicit-virtual-functions fixes to add override keywords to virtual function overrides

  • Add OVERRIDE and FINAL macros to CppMacros.h for VC6 compatibility

  • Use OVERRIDE macro instead of bare override keyword in all affected files

  • Note had to rename a couple of things that conflicted with OVERRIDE and FINAL.

@greptile-apps
Copy link

greptile-apps bot commented Jan 13, 2026

Greptile Overview

Greptile Summary

Applied clang-tidy cppcoreguidelines-explicit-virtual-functions fixes across 43 files by replacing virtual keyword with OVERRIDE macro for backward compatibility with VC6 while enabling modern C++11+ compile-time checks.

Key Changes:

  • Added OVERRIDE and FINAL macros to CppMacros.h with C++11 feature detection (__cplusplus >= 201103L)
  • Systematically replaced virtual with OVERRIDE in function overrides across Core, Generals, and GeneralsMD codebases
  • Covers AI systems, shader interfaces, FX nuggets, state machines, asset iterators, and update modules
  • Preserved original formatting including inline stub implementations (e.g., OVERRIDE{})

Impact:

  • Modern compilers (C++11+): OVERRIDE expands to override keyword, enabling compile-time verification
  • Legacy compilers (VC6/C++98): OVERRIDE expands to empty, maintaining backward compatibility
  • No functional changes, purely code quality improvement for safer virtual function overrides

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are purely mechanical refactoring that add compile-time safety without altering runtime behavior. The OVERRIDE macro correctly expands to override on C++11+ and empty on older compilers, ensuring backward compatibility. All changes follow a consistent pattern applied by clang-tidy, removing virtual and adding OVERRIDE to overridden functions. No logic changes, no new features, no behavioral modifications.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
Dependencies/Utility/Utility/CppMacros.h 5/5 Added OVERRIDE and FINAL macros with proper C++11 feature detection and backward compatibility
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp 5/5 Applied OVERRIDE macro to shader interface implementations throughout multiple shader classes
Generals/Code/GameEngine/Source/GameClient/FXList.cpp 5/5 Replaced virtual with OVERRIDE in multiple FXNugget-derived classes (sound, particle, terrain effects)
Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp 5/5 Comprehensive OVERRIDE application to jet AI state classes for takeoff, landing, taxi, and runway operations
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp 5/5 Replaced virtual with OVERRIDE in asset iterator classes for hierarchical animations, trees, fonts, and render objects

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant CT as clang-tidy
    participant CM as CppMacros.h
    participant Compiler as C++ Compiler
    participant VC6 as VC6 (C++98)
    participant Modern as Modern C++ (C++11+)

    Dev->>CT: Run cppcoreguidelines-explicit-virtual-functions
    CT->>Dev: Identify virtual functions needing override keyword
    
    Dev->>CM: Add OVERRIDE and FINAL macros
    Note over CM: #if __cplusplus >= 201103L<br/>#define OVERRIDE override<br/>#else<br/>#define OVERRIDE<br/>#endif
    
    Dev->>Dev: Replace "virtual" with "OVERRIDE" macro
    Note over Dev: 43 files across Core, Generals, GeneralsMD
    
    alt Modern C++11+ Build
        Modern->>CM: Check __cplusplus >= 201103L
        CM->>Modern: OVERRIDE expands to "override"
        Modern->>Compiler: Compile with override keyword
        Compiler->>Compiler: Verify virtual function override correctness
        Compiler->>Dev: Build Success (with compile-time checks)
    else Legacy VC6 Build
        VC6->>CM: Check __cplusplus >= 201103L
        CM->>VC6: OVERRIDE expands to empty
        VC6->>Compiler: Compile without override keyword
        Compiler->>Dev: Build Success (backward compatible)
    end
Loading

@bobtista bobtista force-pushed the bobtista/clang-tidy-cppcoreguidelines-explicit-virtual-functions branch 2 times, most recently from 9b2b41e to 20a3b96 Compare January 13, 2026 18:26
@bobtista bobtista force-pushed the bobtista/clang-tidy-cppcoreguidelines-explicit-virtual-functions branch from 20a3b96 to 283d9e8 Compare January 14, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant