-
Notifications
You must be signed in to change notification settings - Fork 144
[ZH] Fix compilation using MinGW #547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
There are VC6 breaking changes in this due to the use of c++11 features. If those are required then this cannot be used yet. Marked do not merge for now. |
Thanks, this is definitely not yet ready for merge :) Yes, I was afraid that Maybe macro like |
Perhaps create a univeral macro #if __cplusplus >= 201103L
#define CPP_11(code) code
#else
#define CPP_11(code)
#endifUsed as enum EnumName CPP_11(: int)
{
}Then this macro can be used for different things concerning c++11 features. Or make it enum specific with #if __cplusplus >= 201103L
#define ENUM_UNDERLYING(type) : type
#else
#define ENUM_UNDERLYING(type)
#endif |
Interesting idea with universal |
|
@xezon I addapted approch with Finally made it compile on VC6, I'll clean it up later for easier review (rebasing, combining related commits together, better commit messages etc..) I expect asm replacements to be merged to main first, I'll then rebase my changes on top. If you prefer, I can also make fix of enums (forward declarations) separate PR. (as it is quite a big change set) |
| // | ||
| // typelib filename: <could not determine filename> | ||
|
|
||
| import "oaidl.idl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was already moved to Core folder so you will need to replicate this there.
| // | ||
| // typelib filename: <could not determine filename> | ||
|
|
||
| import "oaidl.idl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IDL file was generated by a tool. Perhaps add a fat comment here that this has been added by hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with MinGW headers. (IDispatch is in oaidl.idl)
| #pragma once | ||
|
|
||
| #include <cassert> | ||
| #define UNIMPLEMEMTED_ERROR(msg) do { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNIMPLEMENTED_ERROR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I had to read it several times to spot the typo :) I'll fix that.
| #include "GameClient/IMEManager.h" | ||
| #include "Win32Device/GameClient/Win32Mouse.h" | ||
| #include "Win32Device/Common/Win32GameEngine.h" | ||
| #include "WWLib/trim.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typing error in commit title:
"[ZH] Removal of duplicit strtrim"
"duplicate"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's probably not an English world, sorry. :) However, I think, this has already been addressed by other PR already in meantime...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you plan to replicate these changes if we decide to merge this before we move things to Core?
Right now the amount of single commits is massive. Replicating this equally to Generals would mean 64 commits for this effort.
Perhaps combine some of the smaller commits into new commits, and also add Generals changes to each Zero Hour change commit once we are happy with Zero Hour? This could perhaps get the commit count down to 24 or so.
Each of the commits needs to be able to compile on their own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I was just planning to do ZH as whole, followed by backport to GEN. But I see, there is quite a lot of activity in this project, causing code to diverge quickly. Also sometimes other efforts (like fixes of warnings) address same things, as this PR.
So now, I am considering breaking this into multiple smaller PRs, (which would probably be [GEN][ZH]). I have seen others following similar approach for their PRs. I would not like to end up in endless rebase loop. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably do bigger change sets as separate PRs (referencing discussions here), hopefully this one will then have more manageable size...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Enum one should be a PR of its own considering how many fines it hits.
Just taking that one out will cleanup a lot of this.
EDIT: NVm i just saw that you did exactly that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second this. Let us get the enum fixes in one single Pull Request, without anything else. A lot of things are going into main line right now, so you want to keep the amount of things that happen inside the Pull Request small, so it can get reviewed swiftly.
|
At level 4 warnings, the untyped enumerations actually create nearly 10k worth of warnings, a lot of it due to the forward declarations in headers. |
|
@xezon @Mauller @OmniBlade @DevGeniusCode Thank you for your reviews. As I have written higher I'll try to separate parts of this into new PRs, to keep this manageble size. (Possibly using this PR for of smaller changes.) I'll address raised issues there, linking this PR with reviews. I'll post link to new derived PRs here |
|
Fixes to forward enum declarations: #665 |
|
Rest of asm made VC only: #670 |
|
Fixes to intrin_compat.h: #671 |
|
COM related fixes: #672 |
|
A number of changes are also a part of the PR for clang-cl compilation: #888 |
|
This change is severely outdated by now. |
|
Is this still having work done to it? With recent changes needed for clang build support, this PR may be significantly simplified when rebased. |
|
@zzambers Is this something you still want to work on? |
Prevent Windows headers from defining min/max macros that conflict with C++ code. Minimal change following PR TheSuperHackers#547 approach - only adds guard, keeps existing min/max macro definitions with their #ifndef guards. Co-authored-by: openhands <openhands@all-hands.dev>
Following PR TheSuperHackers#547 minimal approach: - Add #ifndef guard around NOMINMAX to prevent redefinition warnings - Wrap min/max template functions with _MIN_MAX_TEMPLATES_DEFINED_ guard to prevent conflicts when included multiple times This works with BaseTypeCore.h's NOMINMAX + existing #ifndef guards to resolve all min/max macro/template conflicts. Co-authored-by: openhands <openhands@all-hands.dev>
…re.h - Change min(x,y) to MIN(x,y) macro definition - Change max(x,y) to MAX(x,y) macro definition - Remove NOMINMAX definition (no longer needed with uppercase macros) - Prevents conflicts with C++ template functions from STL - Part of MinGW compatibility improvements following PR TheSuperHackers#547 approach
- Add conditional compilation for MinGW to use STL's min/max functions - Preserve MSVC custom template implementations - Use 'using std::min; using std::max;' for MinGW compatibility - Prevents multiple definition errors when linking with MinGW - Aligns with PR TheSuperHackers#547 approach for MinGW compatibility - Maintains VC6 and MSVC compatibility with existing custom templates
Prevent Windows headers from defining min/max macros that conflict with C++ code. Minimal change following PR TheSuperHackers#547 approach - only adds guard, keeps existing min/max macro definitions with their #ifndef guards.
Following PR TheSuperHackers#547 minimal approach: - Add #ifndef guard around NOMINMAX to prevent redefinition warnings - Wrap min/max template functions with _MIN_MAX_TEMPLATES_DEFINED_ guard to prevent conflicts when included multiple times This works with BaseTypeCore.h's NOMINMAX + existing #ifndef guards to resolve all min/max macro/template conflicts.
…re.h - Change min(x,y) to MIN(x,y) macro definition - Change max(x,y) to MAX(x,y) macro definition - Remove NOMINMAX definition (no longer needed with uppercase macros) - Prevents conflicts with C++ template functions from STL - Part of MinGW compatibility improvements following PR TheSuperHackers#547 approach
- Add conditional compilation for MinGW to use STL's min/max functions - Preserve MSVC custom template implementations - Use 'using std::min; using std::max;' for MinGW compatibility - Prevents multiple definition errors when linking with MinGW - Aligns with PR TheSuperHackers#547 approach for MinGW compatibility - Maintains VC6 and MSVC compatibility with existing custom templates
MinGW-w64 (GCC) does not allow implicit conversion from function pointers to void*. Added explicit (void*) casts to all function pointer entries in the FunctionLexicon lookup tables for both Generals and GeneralsMD. This follows the same approach used in PR TheSuperHackers#547 for MinGW compatibility while maintaining VC6 compatibility with minimal code changes.
Include stddef.h to ensure size_t is properly defined for MinGW builds. This prevents compilation errors where size_t is used but not declared. This fix is based on PR TheSuperHackers#547 by zzambers which addresses MinGW compilation issues throughout the codebase.
Fixes code to be buildable using MinGW. Contains only fixes to game code. Does add support of MinGW to build system (cmake files) or any CI testing yet.
Partially fixes: #486