fix: Resolve macro redefinition warnings#2525
fix: Resolve macro redefinition warnings#2525Skyaero42 wants to merge 5 commits intoTheSuperHackers:mainfrom
Conversation
…rnings. Added guards for WIN32_LEAN_AND_MEAN, _WIN32_WINNT, and NUM_ALPHA_TILES to prevent redefinition. - Related to TheSuperHackers#499 - Related to TheSuperHackers#503
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WWDownload/registry.cpp | Replaces manual WIN32_LEAN_AND_MEAN + windows.h with win.h include; redundant include left behind |
| Core/Libraries/Source/WWVegas/WWLib/thread.cpp | Removes stale _WIN32_WINNT 0x0400 macro define that caused redefinition warnings |
| Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h | Removes duplicate NUM_ALPHA_TILES 8 macro that conflicted with NUM_ALPHA_TILES 12 in WorldHeightMap.h |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[registry.cpp] --> B[Registry.h]
A --> C[win.h]
B --> D[string]
C --> E[WIN32_LEAN_AND_MEAN guard]
E --> F[windows.h]
G[thread.cpp] --> H[thread.h]
G --> I[windows.h via ifdef _WIN32]
J[WHeightMapEdit.h] --> K[WorldHeightMap.h]
K --> L[NUM_ALPHA_TILES = 12]
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Core/Libraries/Source/WWVegas/WWDownload/registry.cpp
Line: 24
Comment:
**Redundant `<string>` include**
`Registry.h` (included on the previous line) already includes `<string>`, making this include redundant.
```suggestion
#include <win.h>
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (5): Last reviewed commit: "refactor: sort includes" | Re-trigger Greptile
|
Could we use add_compile_definitions(WIN32_LEAN_AND_MEAN) in cmake and clean up all the individual defines? |
|
The Pull title needs some polishing. |
done |
Also sorting includes by alphabetic order
| #define WIN32_LEAN_AND_MEAN | ||
| #include <windows.h> | ||
|
|
||
| #include <win.h> |
There was a problem hiding this comment.
Was wondering already whether that would be in scope or not. Its done now
NUM_ALPHA_TILESinGenerals\Wheightmapedit.hwas unused and is removed_WIN32_WINNTwas unused and is removedWIN32_LEAN_AND_MEANwas redefined inregistry.cpp. Included win.h instead, which already handles this macro correctly.