chore: Prevent conflict between clang-format and pre-C++11 nested template parsing#2760
chore: Prevent conflict between clang-format and pre-C++11 nested template parsing#2760DevGeniusCode wants to merge 1 commit into
Conversation
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h | Applies >/**/ fix to class base specifier and four using declarations; the using declarations had > >:: not > > so changes are redundant but harmless |
| Core/Libraries/Source/WWVegas/WWLib/STLUtils.h | Four > > separators in template return types and return expressions replaced with >/**/>; correct and complete |
| Core/Tools/matchbot/wlib/ustring.h | Three instances fixed: class inheritance and two pointer declarations with nested templates; all correct |
| Generals/Code/GameEngine/Source/Common/PerfTimer.cpp | Single fix for std::vector< std::pair<...> > typedef; comment correctly inserted between pair's > and vector's > |
| Core/GameEngine/Include/Common/STLTypedefs.h | Two std::map typedefs with std::less<...> comparator fixed; consistent with rest of PR |
| Generals/Code/GameEngine/Include/GameLogic/GameLogic.h | Three std::hash_map typedefs updated; one for ObjectPtrHash (public), two for private BuildableMap and ControlBarOverrideMap |
| GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h | Mirror of Generals GameLogic.h with same two private typedef fixes applied correctly |
| Core/GameEngine/Include/Common/GameAudio.h | Two fixes: AudioEventInfoHash typedef and m_adjustedVolumes member declaration; both correct |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Pre-C++11 Compiler (VC6)"] -->|"tokenizes '>>' as right-shift"| B["Compilation Error"]
A -->|"sees '> >'"| C["Valid Template Close"]
A -->|"sees '>/**/>'"| D["Valid Template Close"]
subgraph Before["Before (original)"]
E["std::map<Key, Val, std::less<Key> >"]
end
subgraph After["After (this PR)"]
F["std::map<Key, Val, std::less<Key>/**/ >"]
end
E -->|"space separator already present"| C
F -->|"empty comment separator"| D
C --> G["Compiles OK"]
D --> G
Reviews (2): Last reviewed commit: "refactor: Fix pre-C++11 nested template ..." | Re-trigger Greptile
3438f4a to
5bdfbee
Compare
|
Does clang-format preserve the space when the clang format language is set to c++98 ? Or will this cause other issues then (such as failing to recognize constexpr, override, etc)? |
|
The standard is set to c++20, no c++03 |
|
Let me rephrase my question: What happens to the template character parse when changing the clang format language to before c++11 ? |
This PR resolves compilation errors in pre-C++11 compilers (such as VC6) caused by the
>>token sequence in nested template declarations.Instead of restructuring the code with
typedefs, the issue is addressed by safely separating the consecutive closing angle brackets with an empty comment:>/* */>. This prevents the compiler from misinterpreting the sequence as a right-shift operator while preserving the original code structure and type definitions intact.Key Details:
> >) were updated using this pattern.