-
Notifications
You must be signed in to change notification settings - Fork 67
[ZH] Fix level 1 compiler warnings for implicit integer type conversions and uninitialized variables in copy constructors #534
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
Conversation
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 pull numbers in the commit titles are wrong.
GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
916e6d6
to
f05537e
Compare
f05537e
to
add6c02
Compare
add6c02
to
5e4ede3
Compare
5e4ede3
to
5da039b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
6cc3b43
to
d21a323
Compare
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 am a bit skeptical about integer to float changes. What if it changes a math operation somewhere unexpectedly? According to a chatgpt inquiry it could change floating point precision in regards to optimizing more complex statements.
Maybe it would be better to
- Disable warning C5055 in cmake and revert all changes that addressed it
or
- Test that integer to float conversions introduce no game state changes. This would require feature implementation Implement feature to verify replay playback correctness #566
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
Outdated
Show resolved
Hide resolved
Regarding replay checking: I will probably need some time to implement this, but you can already check this manually:
But I also agree, one tiny mistake and we introduce a possible mismatch that might be hard to find. Also these types of warnings rarely indicate real flaws in my experience. So just supressing that warning doesn't seem like such a bad idea to me. |
@xezon, @Mauller, @helmutbuhler There seems to be some concern about floats and after careful consideration, I have to agree with those. Therefore, my proposal is to pick the following.
and discard the others. This still resolves about 2000 warnings. |
bbf389e
to
4a9e82b
Compare
I've undone the float castings. |
dda2218
to
037483a
Compare
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 looks good to go for me, if we get a quick VC6 check with the golden sample replay then it should help identify that the Trig removal is fine and the retail game does not use it either.
VC6 replay tested and verified |
static_cast<int>(0x7439a9d4), static_cast<int>(0x9cea8ac5), static_cast<int>(0x89537c5c), static_cast<int>(0x2588f55d), | ||
static_cast<int>(0x415b5e1d), static_cast<int>(0x216e3d95), static_cast<int>(0x85c662e7), static_cast<int>(0x5e8ab368), | ||
static_cast<int>(0x3ea5cc8c), static_cast<int>(0xd26a0f74), static_cast<int>(0xf3a9222b), static_cast<int>(0x48aad7e4) | ||
(int)0xbaa96887, (int)0x1e17d32c, (int)0x03bcdc3c, (int)0x0f33d1b2, |
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 second commit should be merged into the first commit, because they touch the exact same code.
0x07439a9d4, 0x09cea8ac5, 0x089537c5c, 0x02588f55d, | ||
0x0415b5e1d, 0x0216e3d95, 0x085c662e7, 0x05e8ab368, | ||
0x03ea5cc8c, 0x0d26a0f74, 0x0f3a9222b, 0x048aad7e4 | ||
static_cast<int>(0xbaa96887), static_cast<int>(0x1e17d32c), static_cast<int>(0x03bcdc3c), static_cast<int>(0x0f33d1b2), |
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 first commit uses different wording style than the other commits.
It should say
"[ZH] Fix compiler warnings for [...]"
@@ -531,9 +531,13 @@ class GlobalData : public SubsystemInterface | |||
GlobalData *newOverride( void ); /** create a new override, copy data from previous | |||
override, and return it */ | |||
|
|||
|
|||
#if defined(_MSC_VER) && _MSC_VER < 1300 |
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.
"uninitialised" is misspelled in third commit title.
Perhaps replicate the fixes straight into Generals as well and have 2 commits for [GEN][ZH] ? Would be clean. You could also open 2 Pull Requests for each of the commits, because this pull request has already undergone massive transformation. |
… to signed integer [GEN] Changing cast to c-type (TheSuperHackers#549) [ZH] Fixed warnings of implicit conversion from unsigned to signed integer (TheSuperHackers#534) [ZH] Changing cast to c-type (TheSuperHackers#534)
Safely fixes about 2,500 warnings
Partially resolves #503