fix: Resolve macro redefinition warnings#2525
fix: Resolve macro redefinition warnings#2525Skyaero42 wants to merge 6 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 | Removes redundant WIN32_LEAN_AND_MEAN define and replaces direct <windows.h> include with win.h, which guards the macro properly via #ifndef |
| Core/Libraries/Source/WWVegas/WWLib/thread.cpp | Removes stale _WIN32_WINNT 0x0400 define targeting Windows NT 4.0; the value is unused and redundant with modern SDK defaults |
| Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h | Removes NUM_ALPHA_TILES 8 macro that conflicted with WorldHeightMap.h's definition of 12; the macro has zero uses in WorldBuilder source files |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[registry.cpp] -->|#include| B[Registry.h]
A -->|#include| C[win.h]
C --> D{#ifndef WIN32_LEAN_AND_MEAN}
D -->|not defined| E[#define WIN32_LEAN_AND_MEAN]
D -->|already defined| F[skip define]
E --> G[#include windows.h]
F --> G
H[core_wwcommon CMake] -->|compile definition| I[WIN32_LEAN_AND_MEAN pre-defined]
I -.->|causes F path| D
style A fill:#d4edda
style C fill:#d4edda
style H fill:#cce5ff
Reviews (6): Last reviewed commit: "fix: use correct header encapsulation" | 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
There was a problem hiding this comment.
It still uses <> instead of "", which is unusual.
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.